public class ObjectRecipe extends AbstractRecipe
Modifier and Type | Class and Description |
---|---|
static class |
ObjectRecipe.AutoMatchProperty |
static class |
ObjectRecipe.CompoundProperty |
static class |
ObjectRecipe.FieldMember |
static class |
ObjectRecipe.FieldProperty |
static interface |
ObjectRecipe.Member |
static class |
ObjectRecipe.MethodMember |
static class |
ObjectRecipe.Property |
static class |
ObjectRecipe.SetterProperty |
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
constructorArgNames |
private java.util.List<java.lang.Class<?>> |
constructorArgTypes |
private java.lang.String |
factoryMethod |
private java.util.EnumSet<Option> |
options |
private java.util.LinkedHashMap<ObjectRecipe.Property,java.lang.Object> |
properties |
private PropertyEditorRegistry |
registry |
private java.lang.Class |
typeClass |
private java.lang.String |
typeName |
private java.util.Map<java.lang.String,java.lang.Object> |
unsetProperties |
Constructor and Description |
---|
ObjectRecipe(java.lang.Class typeClass) |
ObjectRecipe(java.lang.Class typeClass,
java.util.Map<java.lang.String,java.lang.Object> properties) |
ObjectRecipe(java.lang.Class typeClass,
java.lang.String factoryMethod) |
ObjectRecipe(java.lang.Class typeClass,
java.lang.String[] constructorArgNames) |
ObjectRecipe(java.lang.Class typeClass,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes) |
ObjectRecipe(java.lang.Class type,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames) |
ObjectRecipe(java.lang.Class type,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes) |
ObjectRecipe(java.lang.Class typeClass,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes,
java.util.Map<java.lang.String,java.lang.Object> properties) |
ObjectRecipe(java.lang.String typeName) |
ObjectRecipe(java.lang.String typeName,
java.util.Map<java.lang.String,java.lang.Object> properties) |
ObjectRecipe(java.lang.String typeName,
java.lang.String factoryMethod) |
ObjectRecipe(java.lang.String typeName,
java.lang.String[] constructorArgNames) |
ObjectRecipe(java.lang.String typeName,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes) |
ObjectRecipe(java.lang.String typeName,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames) |
ObjectRecipe(java.lang.String typeName,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes) |
ObjectRecipe(java.lang.String typeName,
java.lang.String factoryMethod,
java.lang.String[] constructorArgNames,
java.lang.Class[] constructorArgTypes,
java.util.Map<java.lang.String,java.lang.Object> properties) |
Modifier and Type | Method and Description |
---|---|
void |
allow(Option option) |
boolean |
canCreate(java.lang.reflect.Type type) |
void |
disallow(Option option) |
private java.lang.Object[] |
extractConstructorArgs(java.util.Map propertyValues,
ReflectionUtil.Factory factory) |
private ReflectionUtil.Factory |
findFactory(java.lang.reflect.Type expectedType) |
java.util.List<java.lang.String> |
getConstructorArgNames() |
java.util.List<java.lang.Class<?>> |
getConstructorArgTypes() |
java.util.List<Recipe> |
getConstructorRecipes() |
private static java.lang.Object |
getDefaultValue(java.lang.Class type) |
java.lang.String |
getFactoryMethod() |
java.util.List<Recipe> |
getNestedRecipes() |
java.util.Set<Option> |
getOptions() |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
java.lang.Object |
getProperty(java.lang.String name) |
java.lang.Class |
getType() |
java.util.Map<java.lang.String,java.lang.Object> |
getUnsetProperties() |
protected java.lang.Object |
internalCreate(java.lang.reflect.Type expectedType,
boolean lazyRefAllowed) |
void |
setAllProperties(java.util.Map<?,?> map) |
void |
setAutoMatchProperty(java.lang.String type,
java.lang.Object value) |
void |
setCompoundProperty(java.lang.String name,
java.lang.Object value) |
void |
setConstructorArgNames(java.util.List<java.lang.String> constructorArgNames) |
void |
setConstructorArgNames(java.lang.String[] constructorArgNames) |
void |
setConstructorArgTypes(java.lang.Class[] constructorArgTypes) |
void |
setConstructorArgTypes(java.util.List<? extends java.lang.Class<?>> constructorArgTypes) |
void |
setFactoryMethod(java.lang.String factoryMethod) |
void |
setFieldProperty(java.lang.String name,
java.lang.Object value) |
void |
setMethodProperty(java.lang.String name,
java.lang.Object value) |
private void |
setProperties(java.util.Map<ObjectRecipe.Property,java.lang.Object> propertyValues,
java.lang.Object instance,
java.lang.Class clazz) |
void |
setProperties(java.lang.Object instance) |
private void |
setProperty(java.lang.Object instance,
java.lang.Class clazz,
ObjectRecipe.Property propertyName,
java.lang.Object propertyValue) |
private void |
setProperty(ObjectRecipe.Property key,
java.lang.Object value) |
void |
setProperty(java.lang.String name,
java.lang.Object value) |
void |
setRegistry(PropertyEditorRegistry registry) |
java.lang.Class |
setStaticProperties() |
create, create, create, getName, getPriority, setName, toString
private java.lang.String typeName
private java.lang.Class typeClass
private java.lang.String factoryMethod
private java.util.List<java.lang.String> constructorArgNames
private java.util.List<java.lang.Class<?>> constructorArgTypes
private PropertyEditorRegistry registry
private final java.util.LinkedHashMap<ObjectRecipe.Property,java.lang.Object> properties
private final java.util.EnumSet<Option> options
private final java.util.Map<java.lang.String,java.lang.Object> unsetProperties
public ObjectRecipe(java.lang.Class typeClass)
public ObjectRecipe(java.lang.Class typeClass, java.lang.String factoryMethod)
public ObjectRecipe(java.lang.Class typeClass, java.util.Map<java.lang.String,java.lang.Object> properties)
public ObjectRecipe(java.lang.Class typeClass, java.lang.String[] constructorArgNames)
public ObjectRecipe(java.lang.Class typeClass, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
public ObjectRecipe(java.lang.Class type, java.lang.String factoryMethod, java.lang.String[] constructorArgNames)
public ObjectRecipe(java.lang.Class type, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
public ObjectRecipe(java.lang.Class typeClass, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes, java.util.Map<java.lang.String,java.lang.Object> properties)
public ObjectRecipe(java.lang.String typeName)
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod)
public ObjectRecipe(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> properties)
public ObjectRecipe(java.lang.String typeName, java.lang.String[] constructorArgNames)
public ObjectRecipe(java.lang.String typeName, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod, java.lang.String[] constructorArgNames)
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes, java.util.Map<java.lang.String,java.lang.Object> properties)
public void allow(Option option)
public void disallow(Option option)
public java.util.Set<Option> getOptions()
public java.util.List<java.lang.String> getConstructorArgNames()
public void setConstructorArgNames(java.lang.String[] constructorArgNames)
public void setConstructorArgNames(java.util.List<java.lang.String> constructorArgNames)
public java.util.List<java.lang.Class<?>> getConstructorArgTypes()
public void setConstructorArgTypes(java.lang.Class[] constructorArgTypes)
public void setConstructorArgTypes(java.util.List<? extends java.lang.Class<?>> constructorArgTypes)
public java.lang.String getFactoryMethod()
public void setFactoryMethod(java.lang.String factoryMethod)
public java.lang.Object getProperty(java.lang.String name)
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public void setProperty(java.lang.String name, java.lang.Object value)
public void setFieldProperty(java.lang.String name, java.lang.Object value)
public void setMethodProperty(java.lang.String name, java.lang.Object value)
public void setAutoMatchProperty(java.lang.String type, java.lang.Object value)
public void setCompoundProperty(java.lang.String name, java.lang.Object value)
private void setProperty(ObjectRecipe.Property key, java.lang.Object value)
public void setAllProperties(java.util.Map<?,?> map)
public java.util.Map<java.lang.String,java.lang.Object> getUnsetProperties()
public java.util.List<Recipe> getNestedRecipes()
getNestedRecipes
in interface Recipe
getNestedRecipes
in class AbstractRecipe
public java.util.List<Recipe> getConstructorRecipes()
getConstructorRecipes
in interface Recipe
getConstructorRecipes
in class AbstractRecipe
public boolean canCreate(java.lang.reflect.Type type)
protected java.lang.Object internalCreate(java.lang.reflect.Type expectedType, boolean lazyRefAllowed) throws ConstructionException
internalCreate
in class AbstractRecipe
ConstructionException
public void setProperties(java.lang.Object instance) throws ConstructionException
ConstructionException
public java.lang.Class setStaticProperties() throws ConstructionException
ConstructionException
public java.lang.Class getType()
public void setRegistry(PropertyEditorRegistry registry)
private void setProperties(java.util.Map<ObjectRecipe.Property,java.lang.Object> propertyValues, java.lang.Object instance, java.lang.Class clazz)
private void setProperty(java.lang.Object instance, java.lang.Class clazz, ObjectRecipe.Property propertyName, java.lang.Object propertyValue)
private ReflectionUtil.Factory findFactory(java.lang.reflect.Type expectedType)
private java.lang.Object[] extractConstructorArgs(java.util.Map propertyValues, ReflectionUtil.Factory factory)
private static java.lang.Object getDefaultValue(java.lang.Class type)