Class EnhancedType<T>
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.EnhancedType<T>
-
@ThreadSafe @Immutable public class EnhancedType<T> extends Object
Similar toClass, this represents a specific raw class type. UnlikeClass, this allows representing type parameters that would usually be erased.- See Also:
EnhancedType(),of(Class),listOf(Class),mapOf(Class, Class)
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEnhancedType()Create a type token, capturing the generic type arguments of the token asClasses.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> EnhancedType<Collection<T>>collectionOf(Class<T> valueType)Create a type token for a collection, with the provided value type class.static <T> EnhancedType<Collection<T>>collectionOf(EnhancedType<T> valueType)Create a type token for a collection, with the provided value type token.static <T,U>
EnhancedType<ConcurrentMap<T,U>>concurrentMapOf(Class<T> keyType, Class<U> valueType)Create a type token for a concurrent map, with the provided key and value type classes.static <T,U>
EnhancedType<ConcurrentMap<T,U>>concurrentMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)Create a type token for a concurrent map, with the provided key and value type classes.static <T> EnhancedType<Deque<T>>dequeOf(Class<T> valueType)Create a type token for a deque, with the provided value type class.static <T> EnhancedType<Deque<T>>dequeOf(EnhancedType<T> valueType)Create a type token for a deque, with the provided value type token.Optional<EnhancedTypeDocumentConfiguration>documentConfiguration()Retrieve the optionalEnhancedTypeDocumentConfigurationfor this EnhancedTypestatic <T> EnhancedType<T>documentOf(Class<T> documentClass, TableSchema<T> documentTableSchema)Create a type token that represents a document that is specified by the providedTableSchema.static <T> EnhancedType<T>documentOf(Class<T> documentClass, TableSchema<T> documentTableSchema, Consumer<EnhancedTypeDocumentConfiguration.Builder> enhancedTypeConfiguration)Create a type token that represents a document that is specified by the providedTableSchema.booleanequals(Object o)inthashCode()booleanisWildcard()Returns whether or not the type thisEnhancedTypewas created with is a wildcard type.static <T> EnhancedType<List<T>>listOf(Class<T> valueType)Create a type token for a list, with the provided value type class.static <T> EnhancedType<List<T>>listOf(EnhancedType<T> valueType)Create a type token for a list, with the provided value type class.static <T,U>
EnhancedType<Map<T,U>>mapOf(Class<T> keyType, Class<U> valueType)Create a type token for a map, with the provided key and value type classes.static <T,U>
EnhancedType<Map<T,U>>mapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)Create a type token for a map, with the provided key and value type classes.static <T,U>
EnhancedType<NavigableMap<T,U>>navigableMapOf(Class<T> keyType, Class<U> valueType)Create a type token for a navigable map, with the provided key and value type classes.static <T,U>
EnhancedType<NavigableMap<T,U>>navigableMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)Create a type token for a navigable map, with the provided key and value type classes.static <T> EnhancedType<NavigableSet<T>>navigableSetOf(Class<T> valueType)Create a type token for a navigable set, with the provided value type class.static <T> EnhancedType<NavigableSet<T>>navigableSetOf(EnhancedType<T> valueType)Create a type token for a navigable set, with the provided value type token.static <T> EnhancedType<T>of(Class<T> type)Create a type token for the provided non-parameterized class.static EnhancedType<?>of(Type type)Create a type token for the provided non-parameterized class.static <T> EnhancedType<Optional<T>>optionalOf(Class<T> valueType)Create a type token for a optional, with the provided value type class.Class<T>rawClass()Retrieve theClassobject that this type token represents.List<EnhancedType<?>>rawClassParameters()Retrieve theClassobjects of any type parameters for the class that this type token represents.static <T> EnhancedType<Set<T>>setOf(Class<T> valueType)Create a type token for a set, with the provided value type class.static <T> EnhancedType<Set<T>>setOf(EnhancedType<T> valueType)Create a type token for a set, with the provided value type class.static <T,U>
EnhancedType<SortedMap<T,U>>sortedMapOf(Class<T> keyType, Class<U> valueType)Create a type token for a sorted map, with the provided key and value type classes.static <T,U>
EnhancedType<SortedMap<T,U>>sortedMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)Create a type token for a sorted map, with the provided key and value type classes.static <T> EnhancedType<SortedSet<T>>sortedSetOf(Class<T> valueType)Create a type token for a sorted set, with the provided value type class.static <T> EnhancedType<SortedSet<T>>sortedSetOf(EnhancedType<T> valueType)Create a type token for a sorted set, with the provided value type class.Optional<TableSchema<T>>tableSchema()Retrieve theTableSchemafor a modeled document.StringtoString()
-
-
-
Constructor Detail
-
EnhancedType
protected EnhancedType()
Create a type token, capturing the generic type arguments of the token asClasses.This must be called from an anonymous subclass. For example,
new EnhancedType<Iterable<String>>(){}(note the extra {}) for aEnhancedType<Iterable<String>>.
-
-
Method Detail
-
of
public static <T> EnhancedType<T> of(Class<T> type)
Create a type token for the provided non-parameterized class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
of
public static EnhancedType<?> of(Type type)
Create a type token for the provided non-parameterized class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
optionalOf
public static <T> EnhancedType<Optional<T>> optionalOf(Class<T> valueType)
Create a type token for a optional, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
listOf
public static <T> EnhancedType<List<T>> listOf(Class<T> valueType)
Create a type token for a list, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
listOf
public static <T> EnhancedType<List<T>> listOf(EnhancedType<T> valueType)
Create a type token for a list, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
setOf
public static <T> EnhancedType<Set<T>> setOf(Class<T> valueType)
Create a type token for a set, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
setOf
public static <T> EnhancedType<Set<T>> setOf(EnhancedType<T> valueType)
Create a type token for a set, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
sortedSetOf
public static <T> EnhancedType<SortedSet<T>> sortedSetOf(Class<T> valueType)
Create a type token for a sorted set, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
sortedSetOf
public static <T> EnhancedType<SortedSet<T>> sortedSetOf(EnhancedType<T> valueType)
Create a type token for a sorted set, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
dequeOf
public static <T> EnhancedType<Deque<T>> dequeOf(Class<T> valueType)
Create a type token for a deque, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
dequeOf
public static <T> EnhancedType<Deque<T>> dequeOf(EnhancedType<T> valueType)
Create a type token for a deque, with the provided value type token.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
navigableSetOf
public static <T> EnhancedType<NavigableSet<T>> navigableSetOf(Class<T> valueType)
Create a type token for a navigable set, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
navigableSetOf
public static <T> EnhancedType<NavigableSet<T>> navigableSetOf(EnhancedType<T> valueType)
Create a type token for a navigable set, with the provided value type token.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
collectionOf
public static <T> EnhancedType<Collection<T>> collectionOf(Class<T> valueType)
Create a type token for a collection, with the provided value type class.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
collectionOf
public static <T> EnhancedType<Collection<T>> collectionOf(EnhancedType<T> valueType)
Create a type token for a collection, with the provided value type token.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
-
mapOf
public static <T,U> EnhancedType<Map<T,U>> mapOf(Class<T> keyType, Class<U> valueType)
Create a type token for a map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
mapOf
public static <T,U> EnhancedType<Map<T,U>> mapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)
Create a type token for a map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
sortedMapOf
public static <T,U> EnhancedType<SortedMap<T,U>> sortedMapOf(Class<T> keyType, Class<U> valueType)
Create a type token for a sorted map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
sortedMapOf
public static <T,U> EnhancedType<SortedMap<T,U>> sortedMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)
Create a type token for a sorted map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
concurrentMapOf
public static <T,U> EnhancedType<ConcurrentMap<T,U>> concurrentMapOf(Class<T> keyType, Class<U> valueType)
Create a type token for a concurrent map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
concurrentMapOf
public static <T,U> EnhancedType<ConcurrentMap<T,U>> concurrentMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)
Create a type token for a concurrent map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
navigableMapOf
public static <T,U> EnhancedType<NavigableMap<T,U>> navigableMapOf(Class<T> keyType, Class<U> valueType)
Create a type token for a navigable map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
navigableMapOf
public static <T,U> EnhancedType<NavigableMap<T,U>> navigableMapOf(EnhancedType<T> keyType, EnhancedType<U> valueType)
Create a type token for a navigable map, with the provided key and value type classes.Reasons this call may fail with a
RuntimeException:- If the provided types are null.
-
documentOf
public static <T> EnhancedType<T> documentOf(Class<T> documentClass, TableSchema<T> documentTableSchema)
Create a type token that represents a document that is specified by the providedTableSchema.- Parameters:
documentClass- The Class representing the modeled document.documentTableSchema- A TableSchema that describes the properties of the document.- Returns:
- a new
EnhancedTyperepresenting the provided document.
-
documentOf
public static <T> EnhancedType<T> documentOf(Class<T> documentClass, TableSchema<T> documentTableSchema, Consumer<EnhancedTypeDocumentConfiguration.Builder> enhancedTypeConfiguration)
Create a type token that represents a document that is specified by the providedTableSchema.- Parameters:
documentClass- The Class representing the modeled document.documentTableSchema- A TableSchema that describes the properties of the document.enhancedTypeConfiguration- the configuration for this enhanced type- Returns:
- a new
EnhancedTyperepresenting the provided document.
-
isWildcard
public boolean isWildcard()
Returns whether or not the type thisEnhancedTypewas created with is a wildcard type.
-
rawClass
public Class<T> rawClass()
Retrieve theClassobject that this type token represents. e.g. ForEnhancedType<String>, this would returnString.class.
-
tableSchema
public Optional<TableSchema<T>> tableSchema()
Retrieve theTableSchemafor a modeled document. This is used for converting nested documents within a schema.
-
rawClassParameters
public List<EnhancedType<?>> rawClassParameters()
Retrieve theClassobjects of any type parameters for the class that this type token represents.e.g. For
EnhancedType<List<String>>, this would returnString.class, andrawClass()would returnList.class.If there are no type parameters, this will return an empty list.
-
documentConfiguration
public Optional<EnhancedTypeDocumentConfiguration> documentConfiguration()
Retrieve the optionalEnhancedTypeDocumentConfigurationfor this EnhancedType
-
-