Interface CacheType<T>
-
- All Known Implementing Classes:
CacheTypeCapture
,CacheTypeCapture.OfArray
,CacheTypeCapture.OfClass
,CacheTypeCapture.OfGeneric
public interface CacheType<T>
A data structure to retain all known type information from the key and value types, including generic parameters within the cache configuration. A caching application typically constructs a type descriptor with the use of aCacheTypeCapture
orCache2kBuilder
While the type descriptor contains implementation classes, interface consumers must not rely on the implementation types.
About types: If no type information is provided it defaults to the Object class. The provided type information is used inside the cache for optimizations and as well as to select appropriate default transformation schemes for copying objects or marshalling. The correct types are not strictly enforced at all levels by the cache for performance reasons. The cache application guarantees that only the specified types will be used. The cache will check the type compatibility at critical points, e.g. when reconnecting to an external storage. Generic types: An application may provide more detailed type information to the cache, which contains also generic type parameters by providing a
CacheTypeCapture
where the cache can extract the type information.The cache type is immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DESCRIPTOR_TO_STRING_PREFIX
The used prefix for the toString() output.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable CacheType<?>
getComponentType()
The component type in case of an array@Nullable Class<T>
getType()
Class type if not an array.@Nullable CacheType<?>[]
getTypeArguments()
Known type arguments, if the type is a parametrized type.String
getTypeName()
Java language compatible type nameboolean
hasTypeArguments()
The type has generic type parameters and the concrete types are known.boolean
isArray()
This type is an array.static <T> CacheType<T>
of(Class<T> t)
static CacheType<?>
of(Type t)
-
-
-
Field Detail
-
DESCRIPTOR_TO_STRING_PREFIX
static final String DESCRIPTOR_TO_STRING_PREFIX
The used prefix for the toString() output.- See Also:
- Constant Field Values
-
-
Method Detail
-
hasTypeArguments
boolean hasTypeArguments()
The type has generic type parameters and the concrete types are known.getTypeArguments()
returns the arguments.
-
isArray
boolean isArray()
This type is an array. To analyze a multidimensional array descend to the component, for examplegetComponentType().isArray()
.- See Also:
getComponentType()
-
getComponentType
@Nullable @Nullable CacheType<?> getComponentType()
The component type in case of an array
-
getTypeArguments
@Nullable @Nullable CacheType<?>[] getTypeArguments()
Known type arguments, if the type is a parametrized type.
-
getTypeName
String getTypeName()
Java language compatible type name
-
-