简体   繁体   中英

WSO2 Class Mediator - Is it possible to give more complex properties?

Example From the docs here: https://docs.wso2.com/display/ESB470/Class+Mediator

            <class name="samples.mediators.SimpleClassMediator">
                <property name="variable1" value="10"/>
                <property name="variable2" value="5"/>
            </class>

What I would like to do:

            <class name="samples.mediators.SimpleClassMediator">
                <property name="variable1" value="10"/>
                <property name="variable2">
                    <list>                            
                        <foo>bar</foo>
                        <abc>def</abc>
                        <!-- up to 20 more props here -->
                    </list>
                </property>
            </class>

I'm willing to do dirty tricks to enable this if necessary.

You can't set such a complex value to class mediator properties directly. But you can read any property from within the class mediator. For example see this.

<property name="variable2">            
   <list>                                                            
       <foo>bar</foo>                                                            
       <abc>def</abc>                                                
   </list>         
</property>         
<class name="org.wso2.ClassMediator"></class>

Inside class mediator, you can read the property like this.

OMElement ss = (OMElement) mc.getProperty("variable2");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM