Package org.javers.core.metamodel.type
Class ValueType
java.lang.Object
org.javers.core.metamodel.type.JaversType
org.javers.core.metamodel.type.PrimitiveOrValueType
org.javers.core.metamodel.type.ValueType
- All Implemented Interfaces:
CustomComparableType
Value class in a client's domain model is a simple value holder.
JaVers doesn't interact with internal properties of Values and treats them similarly to primitives.
Two Values are compared using
If you don't control the
It's highly advisable to implement Values as immutable objects, like
Values are serialized to JSON using Gson defaults, if it's not what you need, implement
JaVers doesn't interact with internal properties of Values and treats them similarly to primitives.
Two Values are compared using
Object.equals(Object) so
it's highly important to implement it properly by comparing underlying fields.
If you don't control the
equals() implementation in a Value class you can still
provide a CustomValueComparator
and register it with JaversBuilder.registerValue(Class, CustomValueComparator).
It's highly advisable to implement Values as immutable objects, like
BigDecimal or LocalDateTime.
Values are serialized to JSON using Gson defaults, if it's not what you need, implement
JsonTypeAdapter for custom serialization
and register it with JaversBuilder.registerValueTypeAdapter(JsonTypeAdapter).-
Field Summary
Fields inherited from class org.javers.core.metamodel.type.JaversType
DEFAULT_TYPE_PARAMETER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected TypeType for JSON representation.booleanisInstance(Object cdo) valueToString(Object value) Methods inherited from class org.javers.core.metamodel.type.PrimitiveOrValueType
equals, hasCustomValueComparator, isBoolean, isJsonPrimitive, isNumber, isStringy, prettyPrintBuilderMethods inherited from class org.javers.core.metamodel.type.JaversType
buildListOfConcreteTypeArguments, equals, getBaseJavaType, getConcreteClassTypeArguments, getName, hashCode, isGenericType, prettyPrint, spawnConstructorArgs, spawnConstructorArgTypes, toString
-
Constructor Details
-
ValueType
-
ValueType
-
-
Method Details
-
valueToString
-
canBePrototype
public boolean canBePrototype()- Specified by:
canBePrototypein classJaversType
-
isInstance
- Specified by:
isInstancein classJaversType
-
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
-