Package org.javers.core.metamodel.type
Class EntityType
- java.lang.Object
-
- org.javers.core.metamodel.type.JaversType
-
- org.javers.core.metamodel.type.ManagedType
-
- org.javers.core.metamodel.type.EntityType
-
- Direct Known Subclasses:
ShallowReferenceType
public class EntityType extends ManagedType
Entity class in client's domain model.
Has a list of mutable properties and its own identity held in Id-property (or a list of Id-properties).
Two Entity instances are compared using Id-property, seeInstanceId
Example:class Person { @Id private int personId; private String firstName; private String lastName; ... }
-
-
Field Summary
-
Fields inherited from class org.javers.core.metamodel.type.JaversType
DEFAULT_TYPE_PARAMETER
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBePrototype()
InstanceId
createIdFromDeserializedJsonLocalId(java.lang.Object localId)
InstanceId
createIdFromInstance(java.lang.Object instance)
InstanceId
createIdFromInstanceId(java.lang.Object localId)
boolean
equals(java.lang.Object o)
java.lang.Class
getBaseJavaClass()
java.lang.Object
getIdOf(java.lang.Object instance)
java.util.List<JaversProperty>
getIdProperties()
JaversProperty
getIdProperty()
java.lang.reflect.Type
getLocalIdDehydratedJsonType()
boolean
hasCompositeId()
int
hashCode()
boolean
isIdProperty(JaversProperty property)
boolean
isInstance(java.lang.Object cdo)
protected PrettyPrintBuilder
prettyPrintBuilder()
java.lang.String
toString()
-
Methods inherited from class org.javers.core.metamodel.type.ManagedType
findProperty, forEachProperty, getProperties, getProperties, getProperty, getPropertyNames, getRawDehydratedType
-
Methods inherited from class org.javers.core.metamodel.type.JaversType
equals, getBaseJavaType, getConcreteClassTypeArguments, getName, isGenericType, prettyPrint
-
-
-
-
Method Detail
-
getIdProperties
public java.util.List<JaversProperty> getIdProperties()
- Returns:
- an immutable, non-null list with at least one element
-
getIdProperty
public JaversProperty getIdProperty()
- Throws:
java.lang.RuntimeException
- if this Entity has Composite Id
-
hasCompositeId
public boolean hasCompositeId()
-
isIdProperty
public boolean isIdProperty(JaversProperty property)
-
getIdOf
public java.lang.Object getIdOf(java.lang.Object instance)
- Parameters:
instance
- instance ofgetBaseJavaClass()
- Returns:
- returns ID of given instance (value of idProperty)
-
createIdFromInstance
public InstanceId createIdFromInstance(java.lang.Object instance)
-
createIdFromInstanceId
public InstanceId createIdFromInstanceId(java.lang.Object localId)
-
createIdFromDeserializedJsonLocalId
public InstanceId createIdFromDeserializedJsonLocalId(java.lang.Object localId)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classJaversType
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classJaversType
-
toString
public java.lang.String toString()
- Overrides:
toString
in classJaversType
-
prettyPrintBuilder
protected PrettyPrintBuilder prettyPrintBuilder()
- Overrides:
prettyPrintBuilder
in classManagedType
-
getLocalIdDehydratedJsonType
public java.lang.reflect.Type getLocalIdDehydratedJsonType()
-
canBePrototype
public boolean canBePrototype()
- Specified by:
canBePrototype
in classJaversType
-
isInstance
public boolean isInstance(java.lang.Object cdo)
- Specified by:
isInstance
in classJaversType
-
getBaseJavaClass
public java.lang.Class getBaseJavaClass()
-
-