@Test public void getTypeFromEntityDataStore() { Type<BasicUser> basicUserType = RequeryUtils.getType(dataStore, BasicUser.class); assertThat(basicUserType).isEqualTo(BasicUser.$TYPE); }
@SuppressWarnings("unchecked") @Nullable public static <E> Type<E> getType(@Nonnull final EntityDataStore entityDataStore, @Nonnull final Class<E> entityClass) { Assert.notNull(entityDataStore, "entityDataStore must not be null!"); Assert.notNull(entityClass, "entityClass must not be null!"); Set<Type<?>> types = getEntityTypes(entityDataStore); return (Type<E>) types .stream() .filter(it -> entityClass.equals(it.getClassType())) .findFirst() .orElse(null); }
RequeryUtils { @SuppressWarnings("unchecked") @Nullable public static <E> Type<E> getType(@Nonnull final EntityDataStore entityDataStore, @Nonnull final Class<E> entityClass) { Assert.notNull(entityDataStore, "entityDataStore must not be null!"); Assert.notNull(entityClass, "entityClass must not be null!"); Set<Type<?>> types = getEntityTypes(entityDataStore); return (Type<E>) types .stream() .filter(it -> entityClass.equals(it.getClassType())) .findFirst() .orElse(null); } }
RequeryUtils { @SuppressWarnings("unchecked") @Nullable public static <E> Type<E> getType(@Nonnull final EntityDataStore entityDataStore, @Nonnull final Class<E> entityClass) { Assert.notNull(entityDataStore, "entityDataStore must not be null!"); Assert.notNull(entityClass, "entityClass must not be null!"); Set<Type<?>> types = getEntityTypes(entityDataStore); return (Type<E>) types .stream() .filter(it -> entityClass.equals(it.getClassType())) .findFirst() .orElse(null); }  }
RequeryUtils { @SuppressWarnings("unchecked") @Nullable public static <E> Type<E> getType(@Nonnull final EntityDataStore entityDataStore, @Nonnull final Class<E> entityClass) { Assert.notNull(entityDataStore, "entityDataStore must not be null!"); Assert.notNull(entityClass, "entityClass must not be null!"); Set<Type<?>> types = getEntityTypes(entityDataStore); return (Type<E>) types .stream() .filter(it -> entityClass.equals(it.getClassType())) .findFirst() .orElse(null); }  @Nonnull static NamedExpression<?> getKeyExpression(@Nonnull final Class<?> domainClass); @SuppressWarnings("ConstantConditions") @Nonnull static EntityContext getEntityContext(@Nonnull final EntityDataStore entityDataStore); @SuppressWarnings("ConstantConditions") @Nonnull static EntityModel getEntityModel(@Nonnull final EntityDataStore entityDataStore); @Nonnull static Set<Type<?>> getEntityTypes(@Nonnull final EntityDataStore entityDataStore); @Nonnull static List<Class<?>> getEntityClasses(@Nonnull final EntityDataStore entityDataStore); @SuppressWarnings("unchecked") @Nullable static Type<E> getType(@Nonnull final EntityDataStore entityDataStore,
                                      @Nonnull final Class<E> entityClass); static Set<? extends Attribute<E, ?>> getKeyAttributes(@Nonnull final EntityDataStore entityDataStore,
                                                                      @Nonnull final Class<E> entityClass); @Nullable static Attribute<E, ?> getSingleKeyAttribute(@Nonnull final EntityDataStore entityDataStore,
                                                            @Nonnull final Class<E> entityClass); @SuppressWarnings("ConstantConditions") @Nonnull static QueryElement<?> unwrap(@Nonnull final Return<?> wrapper); @SuppressWarnings("unchecked") @Nonnull static QueryElement<?> applyPageable(@Nonnull final Class<E> domainClass,
                                                    @Nonnull final QueryElement<?> baseQuery,
                                                    @Nonnull final Pageable pageable); @SuppressWarnings("unchecked") static QueryElement<?> applySort(@Nonnull final Class<E> domainClass,
                                                @Nonnull final QueryElement<?> baseQuery,
                                                @Nonnull final Sort sort); static @Nonnull OrderingExpression<?>[] getOrderingExpressions(@Nonnull final Class<?> domainClass,
                                                   @Nullable final Sort sort); @SuppressWarnings("unchecked") @Nullable static LogicalCondition<E, ?> foldConditions(@Nonnull final Iterable<Condition<E, ?>> conditions); @SuppressWarnings("unchecked") @Nullable static LogicalCondition<E, ?> foldConditions(@Nonnull final Iterable<Condition<E, ?>> conditions,
                                                            @Nonnull final LogicalOperator operator); @Nonnull static QueryElement<?> applyWhereClause(@Nonnull final QueryElement<?> baseQuery,
                                                   @Nonnull final Set<WhereConditionElement<?>> conditionElements); @Nullable static Field findField(@Nonnull final Class<?> domainClass,
                                  @Nonnull final String fieldName); @Nonnull static List<Field> findFields(@Nonnull final Class<?> domainClass,
                                         @Nonnull final Predicate<Field> fieldPredicate); @Nullable static Field findFirstField(@Nonnull final Class<?> domainClass,
                                       @Nonnull final Predicate<Field> fieldPredicate); @Nonnull static List<Field> findEntityFields(@Nonnull final Class<?> domainClass); static boolean isRequeryEntityField(@Nonnull final Field field); static boolean isRequeryGeneratedField(@Nonnull final Field field); static boolean isTransientField(@Nonnull final Field field); static boolean isEmbededField(@Nonnull final Field field); static boolean isAssociationField(@Nonnull final Field field); }
RequeryUtils { @SuppressWarnings("unchecked") @Nullable public static <E> Type<E> getType(@Nonnull final EntityDataStore entityDataStore, @Nonnull final Class<E> entityClass) { Assert.notNull(entityDataStore, "entityDataStore must not be null!"); Assert.notNull(entityClass, "entityClass must not be null!"); Set<Type<?>> types = getEntityTypes(entityDataStore); return (Type<E>) types .stream() .filter(it -> entityClass.equals(it.getClassType())) .findFirst() .orElse(null); }  @Nonnull static NamedExpression<?> getKeyExpression(@Nonnull final Class<?> domainClass); @SuppressWarnings("ConstantConditions") @Nonnull static EntityContext getEntityContext(@Nonnull final EntityDataStore entityDataStore); @SuppressWarnings("ConstantConditions") @Nonnull static EntityModel getEntityModel(@Nonnull final EntityDataStore entityDataStore); @Nonnull static Set<Type<?>> getEntityTypes(@Nonnull final EntityDataStore entityDataStore); @Nonnull static List<Class<?>> getEntityClasses(@Nonnull final EntityDataStore entityDataStore); @SuppressWarnings("unchecked") @Nullable static Type<E> getType(@Nonnull final EntityDataStore entityDataStore,
                                      @Nonnull final Class<E> entityClass); static Set<? extends Attribute<E, ?>> getKeyAttributes(@Nonnull final EntityDataStore entityDataStore,
                                                                      @Nonnull final Class<E> entityClass); @Nullable static Attribute<E, ?> getSingleKeyAttribute(@Nonnull final EntityDataStore entityDataStore,
                                                            @Nonnull final Class<E> entityClass); @SuppressWarnings("ConstantConditions") @Nonnull static QueryElement<?> unwrap(@Nonnull final Return<?> wrapper); @SuppressWarnings("unchecked") @Nonnull static QueryElement<?> applyPageable(@Nonnull final Class<E> domainClass,
                                                    @Nonnull final QueryElement<?> baseQuery,
                                                    @Nonnull final Pageable pageable); @SuppressWarnings("unchecked") static QueryElement<?> applySort(@Nonnull final Class<E> domainClass,
                                                @Nonnull final QueryElement<?> baseQuery,
                                                @Nonnull final Sort sort); static @Nonnull OrderingExpression<?>[] getOrderingExpressions(@Nonnull final Class<?> domainClass,
                                                   @Nullable final Sort sort); @SuppressWarnings("unchecked") @Nullable static LogicalCondition<E, ?> foldConditions(@Nonnull final Iterable<Condition<E, ?>> conditions); @SuppressWarnings("unchecked") @Nullable static LogicalCondition<E, ?> foldConditions(@Nonnull final Iterable<Condition<E, ?>> conditions,
                                                            @Nonnull final LogicalOperator operator); @Nonnull static QueryElement<?> applyWhereClause(@Nonnull final QueryElement<?> baseQuery,
                                                   @Nonnull final Set<WhereConditionElement<?>> conditionElements); @Nullable static Field findField(@Nonnull final Class<?> domainClass,
                                  @Nonnull final String fieldName); @Nonnull static List<Field> findFields(@Nonnull final Class<?> domainClass,
                                         @Nonnull final Predicate<Field> fieldPredicate); @Nullable static Field findFirstField(@Nonnull final Class<?> domainClass,
                                       @Nonnull final Predicate<Field> fieldPredicate); @Nonnull static List<Field> findEntityFields(@Nonnull final Class<?> domainClass); static boolean isRequeryEntityField(@Nonnull final Field field); static boolean isRequeryGeneratedField(@Nonnull final Field field); static boolean isTransientField(@Nonnull final Field field); static boolean isEmbededField(@Nonnull final Field field); static boolean isAssociationField(@Nonnull final Field field); static final NamedExpression<?> UNKNOWN_KEY_EXPRESSION; }