SPRING: How do you programmatically instantiate classes based on information passed from Flex UI

Posted by babyangel86 on Stack Overflow See other posts from Stack Overflow or by babyangel86
Published on 2010-02-28T14:28:33Z Indexed on 2010/03/14 11:35 UTC
Read the original article Hit count: 271

Filed under:
|
|

Imagine the UI passes back an XMl node as such:

<properties>
<type> Source </type>
<name> Blooper </name>
<delay>
    <type> Deterministic </type>
    <parameters>
       <param>  4 </param>
    </parameters>
<delay>
<batch>
    <type> Erlang </type>
    <parameters>
       <param>  4 </param>
        <param>  6 </param>
    </parameters>
<batch>

And behind the scene what it is asking that you instantiate a class as such:

new Source("blooper", new Exp(4), new Erlang(4,6);

The problem lies in the fact that you don't know what class you will need to processing, and you will be sent a list of these class definitions with instructions on how they can be linked to each other.

I've heard that using a BeanFactoryPostProcessor might be helpful, or a property editor/convertor. However I am at a loss as to how best to use them to solve my problem.

Any help you can provide will be much appreciated.

© Stack Overflow or respective owner

Related posts about spring

Related posts about flex