Class 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
    • 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
      • 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)
      • setAllProperties

        public void setAllProperties​(java.util.Map<?,​?> map)
      • getUnsetProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getUnsetProperties()
      • canCreate

        public boolean canCreate​(java.lang.reflect.Type type)
      • getType

        public java.lang.Class getType()
      • 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)
      • extractConstructorArgs

        private java.lang.Object[] extractConstructorArgs​(java.util.Map propertyValues,
                                                          ReflectionUtil.Factory factory)
      • getDefaultValue

        private static java.lang.Object getDefaultValue​(java.lang.Class type)