/** * {@inheritDoc} */ @Override public <T, E extends Comparable<?>> OrderSpecifier<?> createOrderSpecifier( PathBuilder<T> entityPath, String fieldName, Class<E> fieldType, Order order) { OrderSpecifier<?> orderBy = null; // Get the OrderSpecifier if (order == Order.ASC) { orderBy = entityPath.getComparable(fieldName, fieldType).asc(); } else if (order == Order.DESC) { orderBy = entityPath.getComparable(fieldName, fieldType).desc(); } return orderBy; }
/** * Create an order-by-element in a Query instance * * @param entityPath Full path to entity and associations. For example: * {@code Pet} , {@code Pet.owner} * @param fieldName Property name in the given entity path. For example: * {@code weight} in {@code Pet} entity, {@code age} in * {@code Pet.owner} entity. * @param fieldType Property value {@code Class}. Must implements * {@link Comparable} * @param order ascending or descending order * @return */ public static <T, E extends Comparable<?>> OrderSpecifier<?> createOrderSpecifier( PathBuilder<T> entityPath, String fieldName, Class<E> fieldType, Order order) { OrderSpecifier<?> orderBy = null; // Get the OrderSpecifier if (order == Order.ASC) { orderBy = entityPath.getComparable(fieldName, fieldType).asc(); } else if (order == Order.DESC) { orderBy = entityPath.getComparable(fieldName, fieldType).desc(); } return orderBy; }
/** * @param <A> * @param path * @return */ @SuppressWarnings("unchecked") public <A extends Comparable<?>> ComparablePath<A> get(ComparablePath<A> path) { ComparablePath<A> newPath = getComparable(toString(path), (Class<A>)path.getType()); return addMetadataOf(newPath, path); }
propertyPath = entityPath.getString(propertyName).toLowerCase(); } else { propertyPath = entityPath.getComparable(propertyName, propertyType);