primaryKey
Entity.Key primaryKey()
Returns the primary key of this entity.
If the entity has no primary key attribute defined, this key contains no values.
- Returns:
- the primary key of this entity
Comparable<Entity>static interface Entity instances.static interface static Entity.Builderbuilder(Entity.Key key) <T extends Entity>
Tstatic <T extends Entity>
Collection<T>castTo(Class<T> entityClass,
Collection<Entity> entities) booleancopy()Entity.Builder instance initialized with the values and original values from this entity.deepCopy()static <T> Collection<T>distinct(Attribute<T> attribute,
Collection<? extends Entity> entities) attribute from the given entities.static <T extends Entity>
Collection<T>entitiesByValue(Map<Attribute<?>,Object> values,
Collection<T> entities) static Entityentity(Entity.Key key) entrySet()booleanexists()<T> Tattribute.booleanbooleanstatic LinkedHashMap<EntityType,List<Entity.Key>> mapKeysToType(Collection<Entity.Key> keys) static <T extends Entity>
Map<Entity.Key,T> mapToPrimaryKey(Collection<T> entities) static <T extends Entity>
LinkedHashMap<EntityType,List<T>> mapToType(Collection<? extends T> entities) static <T,
E extends Entity>
LinkedHashMap<T,List<E>> mapToValue(Attribute<T> attribute,
Collection<E> entities) attribute,
respecting the iteration order of the given collectionbooleanmodified()booleanbooleanmutable()<T> Optional<T>attribute, wrapped in an Optional.<T> Tattribute.static Collection<Entity.Key>originalPrimaryKeys(Collection<? extends Entity> entities) static Collection<Entity.Key>primaryKeys(Collection<? extends Entity> entities) <T> TreferencedEntity(ForeignKey foreignKey) ForeignKey.referencedKey(ForeignKey foreignKey) ForeignKey,
if the reference is null this method returns null.static Collection<Entity.Key>referencedKeys(ForeignKey foreignKey,
Collection<? extends Entity> entities) <T> Tvoidrevert()voidvoidsave()void<T> Stringstatic <T> Collection<T>values(Attribute<T> attribute,
Collection<? extends Entity> entities) static <T> Collection<T>values(Collection<Entity.Key> keys) valuesAsString(List<Attribute<?>> attributes,
List<Entity> entities) booleanvaluesEqual(Entity entity) static booleanvaluesEqual(Entity entityOne,
Entity entityTwo) static booleanvaluesEqual(Entity entityOne,
Entity entityTwo,
Attribute<?>... attributes) booleanvaluesEqual(Entity entity,
Collection<? extends Attribute<?>> attributes) compareToT - the value typeattribute - the attributevalue - the valueUnsupportedOperationException - in case this entity is immutableattribute.T - the value typeattribute - the attribute for which to retrieve the valueattribute, wrapped in an Optional.T - the value typeattribute - the attribute for which to retrieve the valueOptionalattribute.
If the value has not been modified the current value is returned.T - the value typeattribute - the attribute for which to retrieve the original valueT - the value typeattribute - the attribute for which to retrieve the valueattributeattribute - the attribute for which to revert the valueUnsupportedOperationException - in case this entity is immutableUnsupportedOperationException - in case this entity is immutableattribute - the attribute for which to save the valueUnsupportedOperationException - in case this entity is immutableUnsupportedOperationException - in case this entity is immutableT - the value typeattribute - the attribute to removeUnsupportedOperationException - in case this entity is immutableattribute - the attributeattribute - the attributeattribute - the attributeForeignKey.
If the underlying reference contains a value, that is,
a foreign key value exists but the actual referenced entity has not
been loaded, an "empty" entity is returned, containing only the referenced
key value(s). Null is returned only if the actual foreign key is null.foreignKey - the foreign key for which to retrieve the valueforeignKeyForeignKey,
if the reference is null this method returns null.foreignKey - the foreign key for which to retrieve the underlying Entity.Keyattribute - the attributeUnsupportedOperationException - in case this entity is immutableentity - the entity to compare toIllegalArgumentException - in case the entity is not of the same typeentity - the entity to compare toattributes - the attributes to compareIllegalArgumentException - in case the entity is not of the same typeentity - the entity to copy or null for clearing all values in this instanceIllegalArgumentException - in case the entity is not of the same typeUnsupportedOperationException - in case this entity is immutableEntity.Builder instance initialized with the values and original values from this entity.Entity.Builder instance.T - the entity class typeentityClass - the entity class to cast toIllegalArgumentException - in case the given entity class has not been associated with the underlying EntityType.key - the keykey - the keyentities - the entitiesforeignKey - the foreign keyentities - the entitiesentities - the entitiesT - the value typekeys - the keysIllegalStateException - in case of a composite keyT - the value typeattribute - the attribute which values to retrieveentities - the entities from which to retrieve the attribute valueattribute from the given entities.T - the value typeattribute - the attribute which values to retrieveentities - the entities from which to retrieve the valuesT - the entity class typeentityClass - the entity class to cast toentities - the entitiesIllegalArgumentException - in case the given entity class has not been associated with the underlying EntityType.T - the entity typeentities - the entities to mapattribute,
respecting the iteration order of the given collectionT - the key typeE - the entity typeattribute - the attribute which value should be used for mappingentities - the entities to map by attribute valueT - the entity typeentities - the entities to map by entityTypekeys - the entity keys to map by entityTypeattributes - the attributesentities - the entitiesT - the entity typevalues - the attribute values to use as condition mapped to their respective attributesentities - the entities to searchentityOne - the first entityentityTwo - the second entityentityOne - the first entityentityTwo - the second entityattributes - the attributes which values to compare