java - Simple XML framework - convert inherited classes with a single Converter -
i using simplexml framework. have 3 classes, b , c extends a:
classes:
public class { } public class b extends { } public class c extends { } i can register converter class a:
seriailization:
registry registry = new registry(); registry.bind(a.class, aconverter.class); strategy strategy = new registrystrategy(registry); serializer serializer = new persister(strategy); converter:
public class aconverter implements converter<a> { @override public read(inputnode n) throws exception { // todo auto-generated method stub return null; } @override public void write(outputnode n, p) throws exception { // todo auto-generated method stub } } problem: aconverter used class (not classes b , c).
how possible register aconverter instances of class (i.e. b , c) ?
note: think combination of (matcher & transform) not case because need many inner blocks inside of ... in future.
have tried
registry.bind(a.class, aconverter.class); registry.bind(b.class, aconverter.class); registry.bind(c.class, aconverter.class);
Comments
Post a Comment