Class 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 Detail

      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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