[Index]

magic-class


Definition for a Magic Bean, which is a bean that can be defined dynamically.

See also arooa:magic-beans.


Property Summary

classLoader The class loader.
name The name of the class.
properties The bean properties.

Example Summary

Example 1 Using a magic-class to create a magic bean.

Property Detail

classLoader

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo. Set automatically by Oddjob.

The class loader.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredYes.

The name of the class.

properties

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

The bean properties. A mapping of name to class name.


Examples

Example 1

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>


(c) R Gordon Ltd 2005 - Present