Class ConstructorCreator<T>

  • Type Parameters:
    T - the model type
    All Implemented Interfaces:
    InstanceCreator<T>, MorphiaInstanceCreator<T>

    public class ConstructorCreator<T>
    extends Object
    implements MorphiaInstanceCreator<T>
    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)
        Parameters:
        model - the model
    • Method Detail

      • getFullConstructor

        public static <T> Constructor<T> getFullConstructor​(EntityModel<T> model)
        Type Parameters:
        T - the model type
        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 <S> void set​(S value,
                            FieldModel<S> model)
        Description copied from interface: InstanceCreator
        Sets a value for the given FieldModel
        Specified by:
        set in interface InstanceCreator<T>
        Type Parameters:
        S - the model's type
        Parameters:
        value - the value
        model - the model