Package org.javers.core.metamodel.type
Class CustomType<T>
- java.lang.Object
-
- org.javers.core.metamodel.type.JaversType
-
- org.javers.core.metamodel.type.CustomType<T>
-
public class CustomType<T> extends JaversType
Custom Type in client's domain model.
JaVers treats a Custom Type as a black box and doesn't take any assumptions about its content or behaviour. It's a "not modeled" type, somehow similar to unbounded wildcard<?>
.
Objects of Custom Type are compared by aCustomPropertyComparator
, and registering this comparator (seeJaversBuilder.registerCustomComparator(CustomPropertyComparator, Class)
is the only way to map a Custom Type.
Custom Types are serialized to JSON using Gson defaults.
-
-
Field Summary
-
Fields inherited from class org.javers.core.metamodel.type.JaversType
DEFAULT_TYPE_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description CustomType(java.lang.reflect.Type baseJavaType, CustomPropertyComparator<T,?> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBePrototype()
boolean
equals(java.lang.Object left, java.lang.Object right)
Used for comparing as Valuesjava.lang.Class
getBaseJavaClass()
CustomPropertyComparator<T,?>
getComparator()
protected java.lang.reflect.Type
getRawDehydratedType()
Type for JSON representation.boolean
isInstance(java.lang.Object cdo)
-
Methods inherited from class org.javers.core.metamodel.type.JaversType
equals, getBaseJavaType, getConcreteClassTypeArguments, getName, hashCode, isGenericType, prettyPrint, prettyPrintBuilder, toString
-
-
-
-
Constructor Detail
-
CustomType
public CustomType(java.lang.reflect.Type baseJavaType, CustomPropertyComparator<T,?> comparator)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object left, java.lang.Object right)
Description copied from class:JaversType
Used for comparing as Values- Overrides:
equals
in classJaversType
-
getComparator
public CustomPropertyComparator<T,?> getComparator()
-
canBePrototype
public boolean canBePrototype()
- Specified by:
canBePrototype
in classJaversType
-
isInstance
public boolean isInstance(java.lang.Object cdo)
- Specified by:
isInstance
in classJaversType
-
getRawDehydratedType
protected java.lang.reflect.Type getRawDehydratedType()
Type for JSON representation. For Values it's simply baseJavaType. For ManagedTypes (references to Entities and ValueObjects) it's GlobalId because JaVers serializes references in the 'dehydrated' form.
-
getBaseJavaClass
public java.lang.Class getBaseJavaClass()
-
-