Package org.cache2k.config
Class CacheTypeCapture<T>
- java.lang.Object
-
- org.cache2k.config.CacheTypeCapture<T>
-
- All Implemented Interfaces:
CacheType<T>
public class CacheTypeCapture<T> extends Object implements CacheType<T>
Helper class to capture generic types into a type descriptor. This is used to provide the cache with detailed type information of the key and value objects. Example usage withCache2kBuilder
:CacheBuilder.newCache().valueType(new CacheType<List<String>(){}).build()
List<String>
for its value.- Author:
- Jens Wilke
- See Also:
- Google Guava CacheType explaination
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheTypeCapture.OfArray
CacheType representing an array.static class
CacheTypeCapture.OfClass<T>
CacheType representing a class.static class
CacheTypeCapture.OfGeneric<T>
CacheType representing a generic type.
-
Field Summary
-
Fields inherited from interface org.cache2k.config.CacheType
DESCRIPTOR_TO_STRING_PREFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CacheTypeCapture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
@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 nameint
hashCode()
boolean
hasTypeArguments()
The type has generic type parameters and the concrete types are known.boolean
isArray()
This type is an array.String
toString()
-
-
-
Method Detail
-
getComponentType
@Nullable public @Nullable CacheType<?> getComponentType()
Description copied from interface:CacheType
The component type in case of an array- Specified by:
getComponentType
in interfaceCacheType<T>
-
getType
@Nullable public @Nullable Class<T> getType()
Description copied from interface:CacheType
Class type if not an array.
-
getTypeArguments
@Nullable public @Nullable CacheType<?>[] getTypeArguments()
Description copied from interface:CacheType
Known type arguments, if the type is a parametrized type.- Specified by:
getTypeArguments
in interfaceCacheType<T>
-
getTypeName
public String getTypeName()
Description copied from interface:CacheType
Java language compatible type name- Specified by:
getTypeName
in interfaceCacheType<T>
-
hasTypeArguments
public boolean hasTypeArguments()
Description copied from interface:CacheType
The type has generic type parameters and the concrete types are known.CacheType.getTypeArguments()
returns the arguments.- Specified by:
hasTypeArguments
in interfaceCacheType<T>
-
isArray
public boolean isArray()
Description copied from interface:CacheType
This type is an array. To analyze a multidimensional array descend to the component, for examplegetComponentType().isArray()
.- Specified by:
isArray
in interfaceCacheType<T>
- See Also:
CacheType.getComponentType()
-
-