Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10593

‘EntityConditionVisitor’ is a confused visitor pattern

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Branch
    • Component/s: None
    • Labels:
      None

      Description

      EntityConditionVisitor interface is supposed to implement the visitor pattern which supposes a set of classes meant to be visited using an accept method and a visitor with multiple visit method overloads (one for each visited class).

      Currently EntityConditionVisitor contains both accept and visit methods which make no sense

      public interface EntityConditionVisitor {
          <T> void visit(T obj);
          <T> void accept(T obj);
          void acceptObject(Object obj);
          void acceptEntityCondition(EntityCondition condition);
          <T extends EntityCondition> void acceptEntityJoinOperator(EntityJoinOperator op, List<T> conditions);
          <L,R,T> void acceptEntityOperator(EntityOperator<L, R, T> op, L lhs, R rhs);
          <L,R> void acceptEntityComparisonOperator(EntityComparisonOperator<L, R> op, L lhs, R rhs);
          void acceptEntityConditionValue(EntityConditionValue value);
          void acceptEntityFieldValue(EntityFieldValue value);
      
          void acceptEntityExpr(EntityExpr expr);
          <T extends EntityCondition> void acceptEntityConditionList(EntityConditionList<T> list);
          void acceptEntityFieldMap(EntityFieldMap fieldMap);
          void acceptEntityConditionFunction(EntityConditionFunction func, EntityCondition nested);
          <T extends Comparable<?>> void acceptEntityFunction(EntityFunction<T> func);
          void acceptEntityWhereString(EntityWhereString condition);
      
          void acceptEntityDateFilterCondition(EntityDateFilterCondition condition);
      }
      

      this confusion is visible in the EntityCondition which has both a visit and an accept method, even if it is only supposed to accept a visitor.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gil portenseigne Gil Portenseigne
                Reporter:
                mthl Mathieu Lirzin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: