Class PropertyModelBuilder


  • @MorphiaInternal
    public final class PropertyModelBuilder
    extends Object
    A builder for programmatically creating FieldModels.
    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

      • alternateName

        public void alternateName​(String name)
        Adds an alternate name
        Parameters:
        name - the new name
      • alternateNames

        public List<String> alternateNames()
        Returns:
        the list of alternate names this model can be known by
        See Also:
        AlsoLoad
      • annotation

        public PropertyModelBuilder annotation​(Annotation annotation)
        Adds an annotation
        Parameters:
        annotation - the annotation
        Returns:
        this
        Since:
        2.3
      • annotations

        public List<Annotation> annotations()
        Returns the read annotations, to be applied when serializing to BSON
        Returns:
        the read annotations
      • discoverMappedName

        @MorphiaInternal
        public PropertyModelBuilder discoverMappedName()
        Returns:
        the mapped name
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getAnnotation

        @Nullable
        public <A extends Annotation> A getAnnotation​(Class<A> type)
        Gets the annotation of this type.
        Type Parameters:
        A - the annotation type
        Parameters:
        type - the annotation class
        Returns:
        the annotation instance or null if this annotation is on the field
      • hasAnnotation

        public boolean hasAnnotation​(Class<? extends Annotation> type)
        Checks this field for an annotation of the given type
        Parameters:
        type - the annotation class
        Returns:
        true if the annotation is used on this field
      • mappedName

        public PropertyModelBuilder mappedName​(String mappedName)
        Sets the field's mapped name
        Parameters:
        mappedName - the name
        Returns:
        this
      • name

        public String name()
        Returns:
        the field name
      • discriminatorEnabled

        public PropertyModelBuilder discriminatorEnabled​(Boolean discriminatorEnabled)
        Enables/disables the use of the discriminator during mapping
        Parameters:
        discriminatorEnabled - true if the discriminator should be used
        Returns:
        this
      • discriminatorEnabled

        public Boolean discriminatorEnabled()
        Returns:
        true if the discriminator is to be used
      • mappedName

        public String mappedName()
        Returns:
        the field's mapped name
      • modifiers

        public int modifiers()
        Returns:
        the modifiers
      • modifiers

        public PropertyModelBuilder modifiers​(int modifiers)
        Parameters:
        modifiers -
        Returns:
        the builder
      • owner

        public PropertyModelBuilder owner​(EntityModel entityModel)
        Sets the entity model owner
        Parameters:
        entityModel - the entity model
        Returns:
        this
        Since:
        2.1
      • owner

        public EntityModel owner()
        Returns:
        the entity model owner
        Since:
        2.1
      • typeData

        public TypeData<?> typeData()
        Returns:
        the type data
      • typeData

        public PropertyModelBuilder typeData​(TypeData<?> typeData)
        Sets the type data
        Parameters:
        typeData - the type data
        Returns:
        this