Class ConstructorCreator

  • All Implemented Interfaces:
    InstanceCreator, MorphiaInstanceCreator

    public class ConstructorCreator
    extends Object
    implements MorphiaInstanceCreator
    Defines a Creator that uses a full constructor to create an instance rather than field injection. This requires that a class have a constructor that accepts a parameter for each mapped field on the class.
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • ConstructorCreator

        public ConstructorCreator​(EntityModel model,
                                  Constructor<?> constructor)
        Parameters:
        model - the model
        constructor - the constructor to use
    • Method Detail

      • getFullConstructor

        public static Constructor<?> getFullConstructor​(EntityModel model)
        Parameters:
        model - the model to check
        Returns:
        the constructor taking all fields if it exists
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getParameterName

        public static String getParameterName​(Parameter parameter)
        Parameters:
        parameter - the parameter
        Returns:
        the name
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • set

        public void set​(@Nullable
                        Object value,
                        PropertyModel model)
        Description copied from interface: InstanceCreator
        Sets a value for the given FieldModel
        Specified by:
        set in interface InstanceCreator
        Parameters:
        value - the value
        model - the model