Package org.javers.core.metamodel.type
Class OptionalType
- java.lang.Object
-
- org.javers.core.metamodel.type.JaversType
-
- org.javers.core.metamodel.type.EnumerableType
-
- org.javers.core.metamodel.type.ContainerType
-
- org.javers.core.metamodel.type.CollectionType
-
- org.javers.core.metamodel.type.OptionalType
-
public class OptionalType extends CollectionType
-
-
Field Summary
-
Fields inherited from class org.javers.core.metamodel.type.JaversType
DEFAULT_TYPE_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description OptionalType(java.lang.reflect.Type baseJavaType, TypeMapperLazy typeMapperLazy)for TypeFactory.spawnFromPrototype()OptionalType(TypeMapperLazy typeMapperLazy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanBePrototype()java.lang.Objectempty()java.lang.ClassgetBaseJavaClass()java.lang.Class<?>getEnumerableInterface()protected java.lang.reflect.TypegetRawDehydratedType()Type for JSON representation.booleanisEmpty(java.lang.Object optional)booleanisInstance(java.lang.Object cdo)protected java.util.stream.Stream<java.lang.Object>items(java.lang.Object source)java.lang.Objectmap(java.lang.Object sourceOptional_, java.util.function.Function mapFunction)Returns a new Enumerable (unmodifiable when possible) with items from sourceEnumerable mapped by mapFunction.java.lang.Objectmap(java.lang.Object sourceOptional_, EnumerableFunction mapFunction, OwnerContext owner)OwnerContext aware version ofEnumerableType.map(Object, EnumerableFunction, OwnerContext)-
Methods inherited from class org.javers.core.metamodel.type.CollectionType
map, mapToList, mapToSet, wrapNull
-
Methods inherited from class org.javers.core.metamodel.type.ContainerType
getItemClass, getItemJavaType, getItemJaversType
-
Methods inherited from class org.javers.core.metamodel.type.EnumerableType
filterToList, getTypeMapperLazy, spawnConstructorArgs, spawnConstructorArgTypes
-
Methods inherited from class org.javers.core.metamodel.type.JaversType
equals, equals, getBaseJavaType, getConcreteClassTypeArguments, getName, hashCode, isGenericType, prettyPrint, prettyPrintBuilder, toString
-
-
-
-
Constructor Detail
-
OptionalType
public OptionalType(java.lang.reflect.Type baseJavaType, TypeMapperLazy typeMapperLazy)for TypeFactory.spawnFromPrototype()
-
OptionalType
public OptionalType(TypeMapperLazy typeMapperLazy)
-
-
Method Detail
-
map
public java.lang.Object map(java.lang.Object sourceOptional_, EnumerableFunction mapFunction, OwnerContext owner)Description copied from class:EnumerableTypeOwnerContext aware version ofEnumerableType.map(Object, EnumerableFunction, OwnerContext)- Overrides:
mapin classCollectionType- Returns:
- immutable List
-
map
public java.lang.Object map(java.lang.Object sourceOptional_, java.util.function.Function mapFunction)Description copied from class:EnumerableTypeReturns a new Enumerable (unmodifiable when possible) with items from sourceEnumerable mapped by mapFunction.- Overrides:
mapin classEnumerableType
-
items
protected java.util.stream.Stream<java.lang.Object> items(java.lang.Object source)
- Overrides:
itemsin classCollectionType
-
isEmpty
public boolean isEmpty(java.lang.Object optional)
- Overrides:
isEmptyin classCollectionType
-
empty
public java.lang.Object empty()
- Overrides:
emptyin classCollectionType
-
getEnumerableInterface
public java.lang.Class<?> getEnumerableInterface()
- Overrides:
getEnumerableInterfacein classCollectionType
-
canBePrototype
public boolean canBePrototype()
- Specified by:
canBePrototypein classJaversType
-
isInstance
public boolean isInstance(java.lang.Object cdo)
- Specified by:
isInstancein 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()
-
-