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(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FetchPathNodeImpl) { return this.fastEquals((FetchPathNodeImpl) obj); } if (!(obj instanceof FetchPath.Node)) { return false; } FetchPath.Node other = (FetchPath.Node) obj; return Nulls.equals(this.name, other.getName()) && this.getterType == other.getGetterType() && this.collectionFetchType == other.getCollectionFetchType() && (this.nextNode == null ? other.getNextNode() == null : this.nextNode.equals(other.getNextNode())); }