Package org.apache.cayenne.access.types
Interface ValueObjectType<V,T>
-
- Type Parameters:
V- type of user's custom object.T- type that custom object will be serialized to/from should be backed by appropriateExtendedType.
- All Known Implementing Classes:
BigDecimalValueType,BigIntegerValueType,CharacterValueType,LocalDateTimeValueType,LocalDateValueType,LocalTimeValueType,PeriodValueType,UUIDValueType
public interface ValueObjectType<V,T>Descriptor and serialization helper for custom value objects that can be safely stored in the DB. Lightweight alternative for theExtendedType.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanequals(V value1, V value2)Allows to use special logic to compare values for equality as in rare cases it is not suffice to use default equals() method.TfromJavaObject(V object)Class<T>getTargetType()Class<V>getValueType()StringtoCacheKey(V object)Returned value should be same for objects that is logically equal.VtoJavaObject(T value)
-
-
-
Method Detail
-
fromJavaObject
T fromJavaObject(V object)
- Parameters:
object- java object- Returns:
- value of type T
-
toCacheKey
String toCacheKey(V object)
Returned value should be same for objects that is logically equal.- Returns:
- String representation usable for cache.
-
equals
default boolean equals(V value1, V value2)
Allows to use special logic to compare values for equality as in rare cases it is not suffice to use default equals() method. Default implementation usesObjects.equals(Object, Object)method.- Parameters:
value1- to comparevalue2- to compare- Returns:
- true if given values are equal
-
-