Because ObjectEngine has made mapMembers private, it's
not possible to override the absolutely annoying
mechanism SwixML (and SwixNG) uses to map XML objects
to the client: public fields only... Not only does this
break encapsulation (big time!), but it blocks the use
of more dynamic mapping mechanism and the use, for
example, of JSR223 scripting.
It would be best if, for example, mapping was a
pluggable behaviour. We could define an interface,
MappingManager, which would receive the id of the
component, the component itself and the client object
and would perform the mapping. The default
implementation could reproduce the SwixML behaviour for
backwards-compatibility.
The same should be done for mapping event listeners.
Reflection should only be one mechanism by which the
system locates the event handler; there should be the
possibility of replacing it with something else.
Unfortunately, as it stands, I cannot use either SwixML
or SwixNG in my current project, as it requires the
ability to use client-side scripting to control the
behaviour of the components.
Logged In: YES
user_id=1346736
public class MyOwnSupport
implements SwixNGSupport
{
/** method from SwixNGSupport to implement */
public void register(ObjectEngine engine )
{
System.out.println("With MyOwnSupport...");
ParserState api = (ParserState) engine.getAPI();
//
// register new tags
//
TagLibrary t = api.tags();
t.registerTag("mycomponent",
MyComponent.class); // <- see you define your own tag
namely "mycomponent".
//
// register new appenders
//
AppenderLibrary a = api.appenders();
a.register(new MyAppender());
//
// register new converters
//
ConverterLibrary c = api.converters();
c.register(new MyUniqueMessageConverter());
// further more you can extract the IdMap from here.
Map<String, Object> idmappings = a.getIdMap();
} // register()
} // MyOwnSupport
mijzcx