public interface Entity extends ValueMap<Property,java.lang.Object>, java.lang.Comparable<Entity>, java.io.Serializable
ValueMap
interface.Modifier and Type | Interface and Description |
---|---|
static interface |
Entity.ColorProvider
Provides background colors for entities.
|
static interface |
Entity.ConditionProvider
Provides condition strings for where clauses
|
static interface |
Entity.Definition
Specifies a entity definition.
|
static interface |
Entity.Key
A class representing a primary key.
|
static interface |
Entity.KeyGenerator
Generates primary key values for entities on insert.
|
static interface |
Entity.OrderBy
Specifies a order by clause
|
static interface |
Entity.ToString
Describes an object responsible for providing String representations of entity instances
|
static interface |
Entity.Validator
Responsible for providing validation for entities.
|
Modifier and Type | Method and Description |
---|---|
void |
clearKeyValues()
Clears the primary key values from this entity,
current as well as original values if any
|
boolean |
containsKey(java.lang.String propertyId)
Returns true if this Entity contains a value for the given property, that value can be null.
|
java.lang.Object |
get(java.lang.String propertyId) |
java.lang.String |
getAsString(java.lang.String propertyId)
This method returns a String representation of the value associated with the given property,
if the property has a format it is used.
|
java.math.BigDecimal |
getBigDecimal(java.lang.String propertyId) |
java.lang.Boolean |
getBoolean(java.lang.String propertyId) |
java.lang.Character |
getCharacter(java.lang.String propertyId) |
java.lang.Object |
getColor(Property property) |
java.time.LocalDate |
getDate(java.lang.String propertyId) |
java.lang.Double |
getDouble(java.lang.String propertyId) |
java.lang.String |
getEntityId() |
Entity |
getForeignKey(ForeignKeyProperty foreignKeyProperty)
Returns the Entity instance referenced by the given foreign key property.
|
Entity |
getForeignKey(java.lang.String foreignKeyPropertyId)
Returns the Entity instance referenced by the given foreign key property.
|
java.lang.String |
getFormatted(Property property,
java.text.Format format) |
java.lang.String |
getFormatted(java.lang.String propertyId,
java.text.Format format) |
java.lang.Integer |
getInteger(java.lang.String propertyId) |
Entity.Key |
getKey() |
Entity.KeyGenerator.Type |
getKeyGeneratorType() |
java.lang.Long |
getLong(java.lang.String propertyId) |
java.lang.Object |
getOriginal(java.lang.String propertyId) |
Entity.Key |
getOriginalKey() |
java.util.List<ColumnProperty> |
getPrimaryKeyProperties() |
java.util.List<Property> |
getProperties() |
Property |
getProperty(java.lang.String propertyId)
Retrieves the property identified by propertyId from the entity repository
|
Entity.Key |
getReferencedKey(ForeignKeyProperty foreignKeyProperty)
Returns the primary key of the entity referenced by the given
ForeignKeyProperty ,
if the reference is null this method returns null. |
java.lang.String |
getString(java.lang.String propertyId) |
java.time.LocalTime |
getTime(java.lang.String propertyId) |
java.time.LocalDateTime |
getTimestamp(java.lang.String propertyId) |
boolean |
is(java.lang.String entityId) |
boolean |
isForeignKeyNull(ForeignKeyProperty foreignKeyProperty)
Returns true if the value of the given foreign key is null, in case of composite
foreign keys a single null value is enough.
|
boolean |
isKeyNull() |
boolean |
isLoaded(java.lang.String foreignKeyPropertyId)
Returns true if the entity referenced via the given foreign key property has been loaded
|
boolean |
isModified(java.lang.String propertyId) |
boolean |
isNotNull(java.lang.String propertyId)
Returns true if a this Entity contains a non-null value mapped to the given property
In case of foreign key properties the value of the underlying reference property is checked.
|
boolean |
isNull(java.lang.String propertyId)
Returns true if a null value is mapped to the given property or if no mapping is found.
|
java.lang.Object |
put(Property property,
java.lang.Object value,
boolean validateType)
Sets the value of the given property
|
java.lang.Object |
put(java.lang.String propertyId,
java.lang.Object value)
Sets the value of the given property
|
java.lang.Object |
remove(java.lang.String propertyId)
Removes the given property and value from this Entity along with the original value if any.
|
void |
revert(java.lang.String propertyId)
Reverts the value associated with the given property to its original value.
|
void |
save(java.lang.String propertyId)
Saves the value associated with the given key, that is, removes the original value.
|
boolean |
valuesEqual(Entity entity) |
addValueListener, clear, containsKey, getAsString, getCopy, getModifiedObserver, getOriginal, getOriginalCopy, getValueObserver, isModified, isModified, isNotNull, isNull, keySet, newInstance, originalKeySet, put, remove, removeValueListener, revert, revertAll, save, saveAll, setAs, size
get
values
java.lang.String getEntityId()
Entity.Key getKey()
Entity.Key getOriginalKey()
Entity.KeyGenerator.Type getKeyGeneratorType()
Property getProperty(java.lang.String propertyId)
propertyId
- the ID of the property to retrievejava.lang.IllegalArgumentException
- in case the property does not exist in this entityjava.util.List<Property> getProperties()
java.util.List<ColumnProperty> getPrimaryKeyProperties()
java.lang.Object get(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuejava.lang.Object getOriginal(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the original valuejava.lang.String getString(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a Stringjava.lang.ClassCastException
- if the value is not a String instancejava.lang.Integer getInteger(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is an Integerjava.lang.ClassCastException
- if the value is not a Integer instancejava.lang.Long getLong(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a Longjava.lang.ClassCastException
- if the value is not a Integer instancejava.lang.Character getCharacter(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a Characterjava.lang.ClassCastException
- if the value is not a Character instancejava.lang.Double getDouble(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a Double.java.lang.ClassCastException
- if the value is not a Double instanceProperty.getMaximumFractionDigits()
java.math.BigDecimal getBigDecimal(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a BigDecimal.java.lang.ClassCastException
- if the value is not a BigDecimal instanceProperty.getMaximumFractionDigits()
java.time.LocalTime getTime(java.lang.String propertyId)
propertyId
- the ID of the date property for which to retrieve the valuepropertyId
,
assuming it is a LocalTimejava.lang.ClassCastException
- if the value is not a LocalTime instancejava.time.LocalDate getDate(java.lang.String propertyId)
propertyId
- the ID of the date property for which to retrieve the valuepropertyId
,
assuming it is a LocalDatejava.lang.ClassCastException
- if the value is not a LocalDate instancejava.time.LocalDateTime getTimestamp(java.lang.String propertyId)
propertyId
- the ID of the date property for which to retrieve the valuepropertyId
,
assuming it is a LocalDatetimejava.lang.ClassCastException
- if the value is not a LocalDateTime instancejava.lang.Boolean getBoolean(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is a Booleanjava.lang.ClassCastException
- if the value is not a Boolean instancejava.lang.String getFormatted(java.lang.String propertyId, java.text.Format format)
propertyId
- the ID of the property for which to retrieve the formatted valueformat
- the format objectpropertyId
, formatted with format
java.lang.String getFormatted(Property property, java.text.Format format)
property
- the property for which to retrieve the formatted valueformat
- the format objectformat
java.lang.String getAsString(java.lang.String propertyId)
propertyId
- the ID of the property for which to retrieve the valueproperty
getFormatted(Property, java.text.Format)
Entity getForeignKey(java.lang.String foreignKeyPropertyId)
foreignKeyPropertyId
- the ID of the property for which to retrieve the valuepropertyId
,
assuming it is an Entityjava.lang.IllegalArgumentException
- if the property is not a foreign key propertyisLoaded(String)
Entity getForeignKey(ForeignKeyProperty foreignKeyProperty)
foreignKeyProperty
- the foreign key property for which to retrieve the valueisLoaded(String)
Entity.Key getReferencedKey(ForeignKeyProperty foreignKeyProperty)
ForeignKeyProperty
,
if the reference is null this method returns null.foreignKeyProperty
- the foreign key property for which to retrieve the underlying Entity.Key
boolean isForeignKeyNull(ForeignKeyProperty foreignKeyProperty)
foreignKeyProperty
- the foreign key propertyjava.lang.Object put(java.lang.String propertyId, java.lang.Object value)
propertyId
- the ID of the propertyvalue
- the valuejava.lang.IllegalArgumentException
- in case the value type does not fit the propertyjava.lang.Object put(Property property, java.lang.Object value, boolean validateType)
property
- the propertyvalue
- the valuevalidateType
- if true then the type of the value is validatedjava.lang.IllegalArgumentException
- in case type validation is enabled, and the value type does not fit the propertyboolean isKeyNull()
boolean isModified(java.lang.String propertyId)
propertyId
- the propertyIdvoid clearKeyValues()
boolean is(java.lang.String entityId)
entityId
- the entityIdboolean valuesEqual(Entity entity)
entity
- the entity to compare toboolean isLoaded(java.lang.String foreignKeyPropertyId)
foreignKeyPropertyId
- the property idjava.lang.Object getColor(Property property)
property
- the property for which to retrieve the colorvoid revert(java.lang.String propertyId)
propertyId
- the ID of the property for which to revert the valuevoid save(java.lang.String propertyId)
propertyId
- the ID of the property for which to save the valueboolean isNull(java.lang.String propertyId)
propertyId
- the ID of the propertyboolean isNotNull(java.lang.String propertyId)
propertyId
- the ID of the propertyboolean containsKey(java.lang.String propertyId)
propertyId
- the propertyIdjava.lang.Object remove(java.lang.String propertyId)
propertyId
- the ID of the property to remove