Example #1
0
 public static QueryPath toStandard(QueryPath queryPath) {
   if (isStandard(queryPath)) {
     return queryPath;
   }
   if (queryPath instanceof QueryPathWrapper) {
     return toStandard(((QueryPathWrapper) queryPath).unwrap());
   }
   if (queryPath instanceof FetchPath) {
     FetchPath fetchPath = (FetchPath) queryPath;
     FetchPath.Builder builder = new FetchPathBuilderImpl();
     for (FetchPath.Node node = fetchPath.getFirstNode();
         node != null;
         node = node.getNextNode()) {
       builder.get(node.getName(), node.getGetterType(), node.getCollectionFetchType());
     }
     return builder.end();
   }
   SimpleOrderPath simpleOrderPath = (SimpleOrderPath) queryPath;
   SimpleOrderPath.Builder builder = new SimpleOrderPathBuilderImpl(simpleOrderPath.isPost());
   for (SimpleOrderPath.Node node = simpleOrderPath.getFirstNode();
       node != null;
       node = node.getNextNode()) {
     builder.get(node.getName(), node.getGetterType());
   }
   return simpleOrderPath.isDesc() ? builder.desc() : builder.asc();
 }
Example #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj instanceof SimpleOrderPathNodeImpl) {
     return this.fastEquals((SimpleOrderPathNodeImpl) obj);
   }
   if (!(obj instanceof SimpleOrderPath.Node)) {
     return false;
   }
   SimpleOrderPath.Node other = (SimpleOrderPath.Node) obj;
   return this.name.equals(other.getName())
       && this.getterType == other.getGetterType()
       && (this.nextNode == null
           ? other.getNextNode() == null
           : this.nextNode.equals(other.getNextNode()));
 }