Package org.oddjob.values.types
Class MagicClassType
java.lang.Object
org.oddjob.values.types.MagicClassType
- All Implemented Interfaces:
ArooaValue,ValueFactory<ArooaClass>
- Author:
- rob
Description
Definition for a Magic Bean, which is a bean that can be defined dynamically.
See also MagicBeanDescriptorFactory.
Example
Using a magic-class to create a magic bean.
<oddjob>
<job>
<sequential>
<jobs>
<variables id="vars">
<myClass>
<magic-class name="fruit">
<properties>
<value key="type" value="java.lang.String"/>
<value key="quantity" value="java.lang.Integer"/>
</properties>
</magic-class>
</myClass>
<myBean>
<convert>
<value>
<bean class="org.oddjob.values.types.MagicBeanType">
<magicClass>
<value value="${vars.myClass}"/>
</magicClass>
<properties>
<value key="type" value="Apple"/>
<value key="quantity" value="24"/>
</properties>
</bean>
</value>
</convert>
</myBean>
</variables>
<echo id="e">We have ${vars.myBean.is.quantity} ${vars.myBean.is.type}(s).</echo>
</jobs>
</sequential>
</job>
</oddjob>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.oddjob.arooa.types.ValueFactory
ValueFactory.Conversions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()getProperties(String key) voidsetClassLoader(ClassLoader classLoader) voidvoidsetProperties(String key, String className) toString()toValue()Provide an instance of the type this is a factory for.
-
Constructor Details
-
MagicClassType
public MagicClassType()
-
-
Method Details
-
getName
-
setName
-
setProperties
-
getProperties
-
getClassLoader
-
setClassLoader
-
toValue
Description copied from interface:ValueFactoryProvide an instance of the type this is a factory for.- Specified by:
toValuein interfaceValueFactory<ArooaClass>- Returns:
- An instance of the type. May be null.
- Throws:
ArooaConversionException- If unable to provide a value.
-
toString
-