@Test public void entity_has_multiple_id_attribute() { assertThat(metamodel.isSingleIdAttribute(Item.class, "id", Integer.class)).isFalse(); }
public boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass, @Nonnull final String name, @Nonnull final Class<?> attributeClass) { return entityModel.getTypes() .stream() .filter(type -> entityClass.equals(type.getClassType())) .findFirst() .flatMap(RequeryMetamodel::getSingleKeyAttribute) .filter(attr -> attr.getClassType().equals(attributeClass)) .map(attr -> attr.getName().equals(name)) .orElse(false); }
RequeryMetamodel { public boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass, @Nonnull final String name, @Nonnull final Class<?> attributeClass) { return entityModel.getTypes() .stream() .filter(type -> entityClass.equals(type.getClassType())) .findFirst() .flatMap(RequeryMetamodel::getSingleKeyAttribute) .filter(attr -> attr.getClassType().equals(attributeClass)) .map(attr -> attr.getName().equals(name)) .orElse(false); } }
RequeryMetamodel { public boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass, @Nonnull final String name, @Nonnull final Class<?> attributeClass) { return entityModel.getTypes() .stream() .filter(type -> entityClass.equals(type.getClassType())) .findFirst() .flatMap(RequeryMetamodel::getSingleKeyAttribute) .filter(attr -> attr.getClassType().equals(attributeClass)) .map(attr -> attr.getName().equals(name)) .orElse(false); } RequeryMetamodel(@Nonnull final EntityModel entityModel); }
RequeryMetamodel { public boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass, @Nonnull final String name, @Nonnull final Class<?> attributeClass) { return entityModel.getTypes() .stream() .filter(type -> entityClass.equals(type.getClassType())) .findFirst() .flatMap(RequeryMetamodel::getSingleKeyAttribute) .filter(attr -> attr.getClassType().equals(attributeClass)) .map(attr -> attr.getName().equals(name)) .orElse(false); } RequeryMetamodel(@Nonnull final EntityModel entityModel); boolean isRequeryManaged(@Nonnull final Class<?> entityClass); boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass,
                                       @Nonnull final String name,
                                       @Nonnull final Class<?> attributeClass); }
RequeryMetamodel { public boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass, @Nonnull final String name, @Nonnull final Class<?> attributeClass) { return entityModel.getTypes() .stream() .filter(type -> entityClass.equals(type.getClassType())) .findFirst() .flatMap(RequeryMetamodel::getSingleKeyAttribute) .filter(attr -> attr.getClassType().equals(attributeClass)) .map(attr -> attr.getName().equals(name)) .orElse(false); } RequeryMetamodel(@Nonnull final EntityModel entityModel); boolean isRequeryManaged(@Nonnull final Class<?> entityClass); boolean isSingleIdAttribute(@Nonnull final Class<?> entityClass,
                                       @Nonnull final String name,
                                       @Nonnull final Class<?> attributeClass);  }