Package dev.morphia.mapping.experimental
Class ConstructorCreator
- java.lang.Object
-
- dev.morphia.mapping.experimental.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 Summary
Constructors Constructor Description ConstructorCreator(EntityModel model, Constructor<?> constructor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Constructor<?>
getFullConstructor(EntityModel model)
Object
getInstance()
static String
getParameterName(Parameter parameter)
void
set(Object value, PropertyModel model)
Sets a value for the given FieldModel
-
-
-
Constructor Detail
-
ConstructorCreator
public ConstructorCreator(EntityModel model, Constructor<?> constructor)
- Parameters:
model
- the modelconstructor
- 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.
-
getInstance
public Object getInstance()
- Specified by:
getInstance
in interfaceInstanceCreator
- Returns:
- the new class instance.
-
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 interfaceInstanceCreator
- Parameters:
value
- the valuemodel
- the model
-
-