Package dev.morphia.mapping.codec.pojo
Class TypeData<T>
- java.lang.Object
-
- dev.morphia.mapping.codec.pojo.TypeData<T>
-
- Type Parameters:
T
- the underlying type being represented
- All Implemented Interfaces:
TypeWithTypeParameters<T>
- Direct Known Subclasses:
WildCardTypeData
@MorphiaInternal public class TypeData<T> extends Object implements TypeWithTypeParameters<T>
Holds type information about a type element- Since:
- 2.0
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TypeData.Builder<T>
A builder for TypeData
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> TypeData.Builder<T>
builder(Class<T> type)
Creates a new builder for ClassTypeDataboolean
equals(Object o)
boolean
getArray()
Class<T>
getType()
List<TypeData<?>>
getTypeParameters()
int
hashCode()
boolean
isArray()
static TypeData<?>
newInstance(Field field)
Creates a TypeData reflecting the type of the given field.static TypeData<?>
newInstance(Method method)
Creates a TypeData reflecting the type of the given method.static <T> TypeData<T>
newInstance(Type genericType)
Creates a TypeData reflecting the given generic type and class.void
setArray(boolean array)
String
toString()
TypeData<?>
withType(Class<?> concreteClass)
Creates a new TypeData with an updated type
-
-
-
Constructor Detail
-
TypeData
public TypeData(Class<T> type, List<TypeData<?>> typeParameters)
Creates a new TypeData with the concrete type and type parameters around it.e.g., List<Address> would be
new TypeData(Address.class, TypeData.builder(List.class).build())
- Parameters:
type
- the typetypeParameters
- the parameters
-
-
Method Detail
-
builder
public static <T> TypeData.Builder<T> builder(Class<T> type)
Creates a new builder for ClassTypeData- Type Parameters:
T
- the type- Parameters:
type
- the class for the type- Returns:
- the builder
-
newInstance
public static TypeData<?> newInstance(Field field)
Creates a TypeData reflecting the type of the given field.- Parameters:
field
- the field to analyze- Returns:
- the new TypeData information
-
newInstance
public static TypeData<?> newInstance(Method method)
Creates a TypeData reflecting the type of the given method.- Parameters:
method
- the method to analyze- Returns:
- the new TypeData information
-
newInstance
public static <T> TypeData<T> newInstance(Type genericType)
Creates a TypeData reflecting the given generic type and class.- Type Parameters:
T
- the type of the new TypeData instance- Parameters:
genericType
- the type to analyze- Returns:
- the new TypeData information
-
getArray
public boolean getArray()
- Returns:
- true if an array
-
getType
public Class<T> getType()
- Specified by:
getType
in interfaceTypeWithTypeParameters<T>
- Returns:
- the class this
ClassTypeData
represents
-
getTypeParameters
public List<TypeData<?>> getTypeParameters()
- Specified by:
getTypeParameters
in interfaceTypeWithTypeParameters<T>
- Returns:
- the type parameters for the class
-
isArray
public boolean isArray()
- Returns:
- true if an array
-
setArray
public void setArray(boolean array)
- Parameters:
array
-
-
-