/** * {@inheritDoc} */ @Override public <T> TypeDescriptor getTypeDescriptor(String fieldName, PathBuilder<T> entity) { Class<?> entityType = entity.getType(); if (entityType == Object.class) { // Remove from path the root "entity" alias String fromRootPath = entity.toString().replaceFirst("^[^.]+[.]", ""); TypeDescriptor fromRoot = getTypeDescriptor(fromRootPath, entity .getRoot().getType()); if (fromRoot == null) { return null; } entityType = fromRoot.getType(); } return getTypeDescriptor(fieldName, entityType); }
/** * Obtains the descriptor of the filtered field * * @param fieldName * @param entity * @return */ public static <T> TypeDescriptor getTypeDescriptor(String fieldName, PathBuilder<T> entity) { Class<?> entityType = entity.getType(); if (entityType == Object.class) { // Remove from path the root "entity" alias String fromRootPath = entity.toString().replaceFirst("^[^.]+[.]", ""); TypeDescriptor fromRoot = getTypeDescriptor(fromRootPath, entity .getRoot().getType()); if (fromRoot == null) { return null; } entityType = fromRoot.getType(); } return getTypeDescriptor(fieldName, entityType); }