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.Builder
builder(Entity.Key key)
boolean
copy()
Entity.Builder
instance initialized with the values and original values from this entity.deepCopy()
static <T> Collection<T>
distinct(Attribute<T> attribute,
Collection<Entity> entities)
attribute
from the given entities.static Collection<Entity>
entitiesByValue(Map<Attribute<?>,Object> values,
Collection<Entity> entities)
entity(ForeignKey foreignKey)
ForeignKey
.static Entity
entity(Entity.Key key)
entrySet()
boolean
exists()
<T> T
attribute
.boolean
boolean
key(ForeignKey foreignKey)
ForeignKey
,
if the reference is null this method returns null.static Collection<Entity.Key>
keys(ForeignKey foreignKey,
Collection<Entity> entities)
static LinkedHashMap<EntityType,List<Entity.Key>>
mapKeysToType(Collection<Entity.Key> keys)
static Map<Entity.Key,Entity>
mapToPrimaryKey(Collection<Entity> entities)
static LinkedHashMap<EntityType,List<Entity>>
mapToType(Collection<Entity> entities)
static <T> LinkedHashMap<T,List<Entity>>
mapToValue(Attribute<T> attribute,
Collection<Entity> entities)
attribute
,
respecting the iteration order of the given collectionboolean
modified()
boolean
boolean
mutable()
<T> Optional<T>
attribute
, wrapped in an Optional
.<T> T
attribute
.static Collection<Entity.Key>
originalPrimaryKeys(Collection<Entity> entities)
static Collection<Entity.Key>
primaryKeys(Collection<Entity> entities)
<T> T
<T> T
void
revert()
void
void
save()
void
<T> String
static <T> Collection<T>
values(Attribute<T> attribute,
Collection<Entity> entities)
static <T> Collection<T>
values(Collection<Entity.Key> keys)
valuesAsString(List<Attribute<?>> attributes,
List<Entity> entities)
boolean
valuesEqual(Entity entity)
static boolean
valuesEqual(Entity entityOne,
Entity entityTwo)
static boolean
valuesEqual(Entity entityOne,
Entity entityTwo,
Attribute<?>... attributes)
boolean
valuesEqual(Entity entity,
Collection<? extends Attribute<?>> attributes)
compareTo
T
- 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 valueOptional
attribute
.
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 valueattribute
attribute
- 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 valueforeignKey
ForeignKey
,
if the reference is null this method returns null.foreignKey
- the foreign key for which to retrieve the underlying Entity.Key
attribute
- 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.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 valuesentities
- the entities to mapIllegalArgumentException
- in case a non-unique primary key is encounteredattribute
,
respecting the iteration order of the given collectionT
- the key typeattribute
- the attribute which value should be used for mappingentities
- the entities to map by attribute valueentities
- the entities to map by entityTypekeys
- the entity keys to map by entityTypeattributes
- the attributesentities
- the entitiesvalues
- 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