Package org.apache.xbean.recipe
Class ObjectRecipe
- java.lang.Object
-
- org.apache.xbean.recipe.AbstractRecipe
-
- org.apache.xbean.recipe.ObjectRecipe
-
- All Implemented Interfaces:
java.io.Serializable
,Recipe
public class ObjectRecipe extends AbstractRecipe
- Version:
- $Rev: 6688 $ $Date: 2005-12-29T02:08:29.200064Z $
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ObjectRecipe(java.lang.Class typeClass)
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.Class typeClass, java.util.Map<java.lang.String,java.lang.Object> properties)
ObjectRecipe(java.lang.String typeName)
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)
ObjectRecipe(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.lang.String[] constructorArgNames)
void
setConstructorArgNames(java.util.List<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)
void
setProperties(java.lang.Object instance)
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)
void
setProperty(java.lang.String name, java.lang.Object value)
private void
setProperty(ObjectRecipe.Property key, java.lang.Object value)
void
setRegistry(PropertyEditorRegistry registry)
java.lang.Class
setStaticProperties()
-
Methods inherited from class org.apache.xbean.recipe.AbstractRecipe
create, create, create, getName, getPriority, setName, toString
-
-
-
-
Field Detail
-
typeName
private java.lang.String typeName
-
typeClass
private java.lang.Class typeClass
-
factoryMethod
private java.lang.String factoryMethod
-
constructorArgNames
private java.util.List<java.lang.String> constructorArgNames
-
constructorArgTypes
private java.util.List<java.lang.Class<?>> constructorArgTypes
-
registry
private PropertyEditorRegistry registry
-
properties
private final java.util.LinkedHashMap<ObjectRecipe.Property,java.lang.Object> properties
-
options
private final java.util.EnumSet<Option> options
-
unsetProperties
private final java.util.Map<java.lang.String,java.lang.Object> unsetProperties
-
-
Constructor Detail
-
ObjectRecipe
public ObjectRecipe(java.lang.Class typeClass)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class typeClass, java.lang.String factoryMethod)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class typeClass, java.util.Map<java.lang.String,java.lang.Object> properties)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class typeClass, java.lang.String[] constructorArgNames)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class typeClass, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class type, java.lang.String factoryMethod, java.lang.String[] constructorArgNames)
-
ObjectRecipe
public ObjectRecipe(java.lang.Class type, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
-
ObjectRecipe
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)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> properties)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.lang.String[] constructorArgNames)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod, java.lang.String[] constructorArgNames)
-
ObjectRecipe
public ObjectRecipe(java.lang.String typeName, java.lang.String factoryMethod, java.lang.String[] constructorArgNames, java.lang.Class[] constructorArgTypes)
-
ObjectRecipe
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)
-
-
Method Detail
-
allow
public void allow(Option option)
-
disallow
public void disallow(Option option)
-
getOptions
public java.util.Set<Option> getOptions()
-
getConstructorArgNames
public java.util.List<java.lang.String> getConstructorArgNames()
-
setConstructorArgNames
public void setConstructorArgNames(java.lang.String[] constructorArgNames)
-
setConstructorArgNames
public void setConstructorArgNames(java.util.List<java.lang.String> constructorArgNames)
-
getConstructorArgTypes
public java.util.List<java.lang.Class<?>> getConstructorArgTypes()
-
setConstructorArgTypes
public void setConstructorArgTypes(java.lang.Class[] constructorArgTypes)
-
setConstructorArgTypes
public void setConstructorArgTypes(java.util.List<? extends java.lang.Class<?>> constructorArgTypes)
-
getFactoryMethod
public java.lang.String getFactoryMethod()
-
setFactoryMethod
public void setFactoryMethod(java.lang.String factoryMethod)
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)
-
setFieldProperty
public void setFieldProperty(java.lang.String name, java.lang.Object value)
-
setMethodProperty
public void setMethodProperty(java.lang.String name, java.lang.Object value)
-
setAutoMatchProperty
public void setAutoMatchProperty(java.lang.String type, java.lang.Object value)
-
setCompoundProperty
public void setCompoundProperty(java.lang.String name, java.lang.Object value)
-
setProperty
private void setProperty(ObjectRecipe.Property key, java.lang.Object value)
-
setAllProperties
public void setAllProperties(java.util.Map<?,?> map)
-
getUnsetProperties
public java.util.Map<java.lang.String,java.lang.Object> getUnsetProperties()
-
getNestedRecipes
public java.util.List<Recipe> getNestedRecipes()
- Specified by:
getNestedRecipes
in interfaceRecipe
- Overrides:
getNestedRecipes
in classAbstractRecipe
-
getConstructorRecipes
public java.util.List<Recipe> getConstructorRecipes()
- Specified by:
getConstructorRecipes
in interfaceRecipe
- Overrides:
getConstructorRecipes
in classAbstractRecipe
-
canCreate
public boolean canCreate(java.lang.reflect.Type type)
-
internalCreate
protected java.lang.Object internalCreate(java.lang.reflect.Type expectedType, boolean lazyRefAllowed) throws ConstructionException
- Specified by:
internalCreate
in classAbstractRecipe
- Throws:
ConstructionException
-
setProperties
public void setProperties(java.lang.Object instance) throws ConstructionException
- Throws:
ConstructionException
-
setStaticProperties
public java.lang.Class setStaticProperties() throws ConstructionException
- Throws:
ConstructionException
-
getType
public java.lang.Class getType()
-
setRegistry
public void setRegistry(PropertyEditorRegistry registry)
-
setProperties
private void setProperties(java.util.Map<ObjectRecipe.Property,java.lang.Object> propertyValues, java.lang.Object instance, java.lang.Class clazz)
-
setProperty
private void setProperty(java.lang.Object instance, java.lang.Class clazz, ObjectRecipe.Property propertyName, java.lang.Object propertyValue)
-
findFactory
private ReflectionUtil.Factory findFactory(java.lang.reflect.Type expectedType)
-
extractConstructorArgs
private java.lang.Object[] extractConstructorArgs(java.util.Map propertyValues, ReflectionUtil.Factory factory)
-
getDefaultValue
private static java.lang.Object getDefaultValue(java.lang.Class type)
-
-