Package dev.morphia.mapping.codec.pojo
Class FieldModel<T>
- java.lang.Object
-
- dev.morphia.mapping.codec.pojo.FieldModel<T>
-
- Type Parameters:
T
- the type of the field that the FieldModel represents.
public final class FieldModel<T> extends Object
Represents a field on a class and stores various metadata such as generic parameters.- 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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> FieldModelBuilder<T>
builder()
Create a newFieldModelBuilder
boolean
equals(Object o)
org.bson.codecs.pojo.PropertyAccessor<T>
getAccessor()
<A extends Annotation>
AgetAnnotation(Class<A> type)
Find an annotation of a specific type or null if not found.List<Annotation>
getAnnotations()
org.bson.codecs.Codec<T>
getCachedCodec()
org.bson.codecs.Codec<T>
getCodec()
Field
getField()
String
getMappedName()
String
getName()
Class<?>
getNormalizedType()
Gets the parameterized type of a List or the key type of a Map, e.g.morphia.org.bson.codecs.pojo.TypeData<T>
getTypeData()
int
hashCode()
static Class<?>
normalize(morphia.org.bson.codecs.pojo.TypeData<?> toNormalize)
Gets the parameterized type of a TypeDataboolean
shouldSerialize(T value)
Checks a value against the configured rules for serializationString
toString()
-
-
-
Method Detail
-
builder
public static <T> FieldModelBuilder<T> builder()
Create a newFieldModelBuilder
- Type Parameters:
T
- the type of the field- Returns:
- the builder
-
normalize
public static Class<?> normalize(morphia.org.bson.codecs.pojo.TypeData<?> toNormalize)
Gets the parameterized type of a TypeData- Parameters:
toNormalize
- the type to normalize- Returns:
- the unwrapped type
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getAccessor
public org.bson.codecs.pojo.PropertyAccessor<T> getAccessor()
- Returns:
- the accessor to use when accessing this field
-
getAnnotation
public <A extends Annotation> A getAnnotation(Class<A> type)
Find an annotation of a specific type or null if not found.- Type Parameters:
A
- the class type- Parameters:
type
- the annotation type to find- Returns:
- the annotation instance or null
-
getAnnotations
public List<Annotation> getAnnotations()
- Returns:
- the annotations on this Field
-
getCachedCodec
public org.bson.codecs.Codec<T> getCachedCodec()
- Returns:
- the cached codec
-
getCodec
public org.bson.codecs.Codec<T> getCodec()
- Returns:
- the custom codec to use if set or null
-
getField
public Field getField()
- Returns:
- the field
-
getMappedName
public String getMappedName()
- Returns:
- the mapped name for the model
-
getName
public String getName()
- Returns:
- the field name for the model
-
getNormalizedType
public Class<?> getNormalizedType()
Gets the parameterized type of a List or the key type of a Map, e.g.- Returns:
- the unwrapped type
-
getTypeData
public morphia.org.bson.codecs.pojo.TypeData<T> getTypeData()
- Returns:
- the type data for the field
-
shouldSerialize
public boolean shouldSerialize(T value)
Checks a value against the configured rules for serialization- Parameters:
value
- the value to check- Returns:
- true if the given value should be serialized
-
-