Removed binding handler from element interface so there is only one

layer of binding handlers per module per language.
This commit is contained in:
Willem Cazander 2013-08-24 18:07:51 +02:00
parent b922b0fd81
commit df1f1fb959
8 changed files with 2 additions and 56 deletions

View file

@ -146,7 +146,6 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
ec = createElementClass(language,"bindingHandler",null,BeanElement.class,"Defines generic binding handler for languge."); ec = createElementClass(language,"bindingHandler",null,BeanElement.class,"Defines generic binding handler for languge.");
ec.addElementParent(CEL_ROOT_URI, "module"); ec.addElementParent(CEL_ROOT_URI, "module");
ec.addElementParent(CEL_CORE_URI, "elementInterface");
ec.addElementClassAttribute(createElementClassAttribute(language,"id",true,null)); ec.addElementClassAttribute(createElementClassAttribute(language,"id",true,null));
ec.addElementClassAttribute(createElementClassAttribute(language,"bean.class",true,null)); ec.addElementClassAttribute(createElementClassAttribute(language,"bean.class",true,null));
namespace.addElementClass(ec); namespace.addElementClass(ec);

View file

@ -24,7 +24,6 @@ package org.x4o.xml.eld.lang;
import org.x4o.xml.element.AbstractElementBindingHandler; import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element; import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementBindingHandlerException; import org.x4o.xml.element.ElementBindingHandlerException;
import org.x4o.xml.element.ElementClassAttribute; import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementConfigurator; import org.x4o.xml.element.ElementConfigurator;
@ -40,8 +39,7 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle
private final static Class<?>[] CLASSES_CHILD = new Class[] { private final static Class<?>[] CLASSES_CHILD = new Class[] {
ElementClassAttribute.class, ElementClassAttribute.class,
ElementConfigurator.class, ElementConfigurator.class
ElementBindingHandler.class
}; };
/** /**
@ -62,9 +60,6 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle
* @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,ElementInterface parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,ElementInterface parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ElementBindingHandler) {
parent.addElementBindingHandler((ElementBindingHandler)childObject);
}
if (childObject instanceof ElementClassAttribute) { if (childObject instanceof ElementClassAttribute) {
parent.addElementClassAttribute((ElementClassAttribute)childObject); parent.addElementClassAttribute((ElementClassAttribute)childObject);
} }
@ -77,9 +72,6 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
public void createChilderen(Element parentElement,ElementInterface parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,ElementInterface parent) throws ElementBindingHandlerException {
for (ElementBindingHandler child:parent.getElementBindingHandlers()) {
createChild(parentElement, child);
}
for (ElementClassAttribute child:parent.getElementClassAttributes()) { for (ElementClassAttribute child:parent.getElementClassAttributes()) {
createChild(parentElement, child); createChild(parentElement, child);
} }

View file

@ -22,9 +22,6 @@
*/ */
package org.x4o.xml.element; package org.x4o.xml.element;
import java.util.ArrayList;
import java.util.List;
/** /**
* AbstractElementInterface extends base support with element interface support. * AbstractElementInterface extends base support with element interface support.
* *
@ -34,29 +31,11 @@ import java.util.List;
public abstract class AbstractElementInterface extends AbstractElementClassBase implements ElementInterface { public abstract class AbstractElementInterface extends AbstractElementClassBase implements ElementInterface {
private Class<?> interfaceClass = null; private Class<?> interfaceClass = null;
private List<ElementBindingHandler> elementBindingHandlers = null;
/** /**
* Creates AbstractElementInterface. * Creates AbstractElementInterface.
*/ */
public AbstractElementInterface() { public AbstractElementInterface() {
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
}
/**
* @see org.x4o.xml.element.ElementInterface#addElementBindingHandler(org.x4o.xml.element.ElementBindingHandler)
* @param elementBindingHandler The binding handler to add.
*/
public void addElementBindingHandler(ElementBindingHandler elementBindingHandler) {
elementBindingHandlers.add(elementBindingHandler);
}
/**
* @see org.x4o.xml.element.ElementInterface#getElementBindingHandlers()
* @return All binding handlers.
*/
public List<ElementBindingHandler> getElementBindingHandlers() {
return elementBindingHandlers;
} }
/** /**

View file

@ -22,8 +22,6 @@
*/ */
package org.x4o.xml.element; package org.x4o.xml.element;
import java.util.List;
/** /**
* Defines an ElementInterface. * Defines an ElementInterface.
* *
@ -43,16 +41,4 @@ public interface ElementInterface extends ElementClassBase {
* @param interfaceClass the interfaceClass to set. * @param interfaceClass the interfaceClass to set.
*/ */
void setInterfaceClass(Class<?> interfaceClass); void setInterfaceClass(Class<?> interfaceClass);
/**
* Adds an ElementBindingHanlder.
* @param elementBindingHandler The ElementBindingHandler to add.
*/
void addElementBindingHandler(ElementBindingHandler elementBindingHandler);
/**
* Gets all ElementBindingHandlers.
* @return Returns all the ElementBindingHandlers.
*/
List<ElementBindingHandler> getElementBindingHandlers();
} }

View file

@ -261,7 +261,6 @@ public class X4ODebugWriter {
atts.addAttribute ("", "interfaceClass", "", "", elementInterface.getInterfaceClass().getName()); atts.addAttribute ("", "interfaceClass", "", "", elementInterface.getInterfaceClass().getName());
contentWriter.startElement (DEBUG_URI, "elementInterface", "", atts); contentWriter.startElement (DEBUG_URI, "elementInterface", "", atts);
debugElementBindingHandler(elementInterface.getElementBindingHandlers());
debugElementClassBase(elementInterface); debugElementClassBase(elementInterface);
contentWriter.endElement(DEBUG_URI, "elementInterface", ""); contentWriter.endElement(DEBUG_URI, "elementInterface", "");
} }

View file

@ -181,9 +181,6 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
X4OLanguageModule module = elementLanguageModules.get(i); X4OLanguageModule module = elementLanguageModules.get(i);
findElementBindingHandlerInList(parent,null,result,module.getElementBindingHandlers(),false); findElementBindingHandlerInList(parent,null,result,module.getElementBindingHandlers(),false);
} }
for (ElementInterface ei:findElementInterfaces(parent)) {
findElementBindingHandlerInList(parent,null,result,ei.getElementBindingHandlers(),false);
}
return result; return result;
} }
@ -196,9 +193,6 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
X4OLanguageModule module = elementLanguageModules.get(i); X4OLanguageModule module = elementLanguageModules.get(i);
findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers(),true); findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers(),true);
} }
for (ElementInterface ei:findElementInterfaces(parent)) {
findElementBindingHandlerInList(parent,child,result,ei.getElementBindingHandlers(),true);
}
return result; return result;
} }

View file

@ -127,7 +127,6 @@
<description>The class of the binding handler.</description> <description>The class of the binding handler.</description>
</attribute> </attribute>
<elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/> <elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/>
<elementParent tag="elementInterface"/>
</element> </element>
<element id="attributeHandler" elementClass="org.x4o.xml.eld.lang.BeanElement"> <element id="attributeHandler" elementClass="org.x4o.xml.eld.lang.BeanElement">

View file

@ -141,7 +141,6 @@ public class EldDocWriter {
adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_BINDING,ElementBindingHandler.class)); adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_BINDING,ElementBindingHandler.class));
adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE,ElementClassAttribute.class)); adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE,ElementClassAttribute.class));
adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR,ElementConfigurator.class)); adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR,ElementConfigurator.class));
adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_BINDING,ElementBindingHandler.class));
adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_CONFIGURATOR,ElementConfigurator.class)); adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_CONFIGURATOR,ElementConfigurator.class));
adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class)); adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class));
@ -158,7 +157,6 @@ public class EldDocWriter {
for (ElementConfiguratorGlobal conf:mod.getElementConfiguratorGlobals()) { modNode.addNode(createNodeElementConfiguratorGlobal(conf)); } for (ElementConfiguratorGlobal conf:mod.getElementConfiguratorGlobals()) { modNode.addNode(createNodeElementConfiguratorGlobal(conf)); }
for (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface)); for (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface));
for (ElementClassAttribute eca:iface.getElementClassAttributes()) { ifaceNode.addNode(createNodeElementClassAttribute(eca)); } for (ElementClassAttribute eca:iface.getElementClassAttributes()) { ifaceNode.addNode(createNodeElementClassAttribute(eca)); }
for (ElementBindingHandler bind:iface.getElementBindingHandlers()) { ifaceNode.addNode(createNodeElementBindingHandler(bind)); }
for (ElementConfigurator conf:iface.getElementConfigurators()) { ifaceNode.addNode(createNodeElementConfigurator(conf)); } } for (ElementConfigurator conf:iface.getElementConfigurators()) { ifaceNode.addNode(createNodeElementConfigurator(conf)); } }
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespaceContext(ns)); for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespaceContext(ns));
for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec)); for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec));