configType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)
{
return new Config();
}
}
);
configType.pushInterceptor(new QName("attribute"), new DefaultElementInterceptor()
{
public void add(Object parent, Object child, QName name)
{
Config config = (Config)parent;
Config.ConfigAttr attr = (Config.ConfigAttr)child;
Collection<ConfigAttr> attrs = config.getAttrs();
if(attrs == null)
{
attrs = new ArrayList<ConfigAttr>();
config.setAttrs(attrs);
}
attrs.add(attr);
}
}
);
configType.pushInterceptor(new QName("beans"), new DefaultElementInterceptor()
{
public void add(Object parent, Object child, QName name)
{
Config config = (Config)parent;
config.beans = (Collection<Bean>)child;
}
}
);
configType.pushInterceptor(new QName("list"), new DefaultElementInterceptor()
{
public void add(Object parent, Object child, QName name)
{
Config config = (Config)parent;
config.list = (Collection<Object>)child;
}
}
);
configType.pushInterceptor(new QName("map"), new DefaultElementInterceptor()
{
public void add(Object parent, Object child, QName name)
{
Config config = (Config)parent;
config.map = (Map<?, ?>)child;
}
}
);