From df1f1fb959aa9b3b3e63acd715dd66402e09376d Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sat, 24 Aug 2013 18:07:51 +0200 Subject: [PATCH] Removed binding handler from element interface so there is only one layer of binding handlers per module per language. --- .../org/x4o/xml/eld/EldModuleLoaderCore.java | 1 - .../lang/ElementInterfaceBindingHandler.java | 10 +------- .../xml/element/AbstractElementInterface.java | 23 +------------------ .../org/x4o/xml/element/ElementInterface.java | 14 ----------- .../org/x4o/xml/io/sax/X4ODebugWriter.java | 1 - .../org/x4o/xml/lang/DefaultX4OLanguage.java | 6 ----- .../main/resources/META-INF/eld/eld-lang.eld | 1 - .../org/x4o/xml/eld/doc/EldDocWriter.java | 2 -- 8 files changed, 2 insertions(+), 56 deletions(-) diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java b/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java index c828dd6..1ef57e2 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java @@ -146,7 +146,6 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader { ec = createElementClass(language,"bindingHandler",null,BeanElement.class,"Defines generic binding handler for languge."); ec.addElementParent(CEL_ROOT_URI, "module"); - ec.addElementParent(CEL_CORE_URI, "elementInterface"); ec.addElementClassAttribute(createElementClassAttribute(language,"id",true,null)); ec.addElementClassAttribute(createElementClassAttribute(language,"bean.class",true,null)); namespace.addElementClass(ec); diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/lang/ElementInterfaceBindingHandler.java b/x4o-driver/src/main/java/org/x4o/xml/eld/lang/ElementInterfaceBindingHandler.java index e079552..6e33f5b 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/lang/ElementInterfaceBindingHandler.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/lang/ElementInterfaceBindingHandler.java @@ -24,7 +24,6 @@ package org.x4o.xml.eld.lang; import org.x4o.xml.element.AbstractElementBindingHandler; import org.x4o.xml.element.Element; -import org.x4o.xml.element.ElementBindingHandler; import org.x4o.xml.element.ElementBindingHandlerException; import org.x4o.xml.element.ElementClassAttribute; import org.x4o.xml.element.ElementConfigurator; @@ -40,8 +39,7 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle private final static Class[] CLASSES_CHILD = new Class[] { ElementClassAttribute.class, - ElementConfigurator.class, - ElementBindingHandler.class + ElementConfigurator.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) */ public void bindChild(Element childElement,ElementInterface parent, Object childObject) throws ElementBindingHandlerException { - if (childObject instanceof ElementBindingHandler) { - parent.addElementBindingHandler((ElementBindingHandler)childObject); - } if (childObject instanceof ElementClassAttribute) { 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) */ public void createChilderen(Element parentElement,ElementInterface parent) throws ElementBindingHandlerException { - for (ElementBindingHandler child:parent.getElementBindingHandlers()) { - createChild(parentElement, child); - } for (ElementClassAttribute child:parent.getElementClassAttributes()) { createChild(parentElement, child); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementInterface.java b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementInterface.java index b40d70c..da49385 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementInterface.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementInterface.java @@ -22,9 +22,6 @@ */ package org.x4o.xml.element; -import java.util.ArrayList; -import java.util.List; - /** * AbstractElementInterface extends base support with element interface support. * @@ -34,31 +31,13 @@ import java.util.List; public abstract class AbstractElementInterface extends AbstractElementClassBase implements ElementInterface { private Class interfaceClass = null; - private List elementBindingHandlers = null; /** * Creates AbstractElementInterface. */ public AbstractElementInterface() { - elementBindingHandlers = new ArrayList(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 getElementBindingHandlers() { - return elementBindingHandlers; - } - /** * @see org.x4o.xml.element.ElementInterface#getInterfaceClass() * @return The interface class @@ -66,7 +45,7 @@ public abstract class AbstractElementInterface extends AbstractElementClassBase public Class getInterfaceClass() { return interfaceClass; } - + /** * @see org.x4o.xml.element.ElementInterface#setInterfaceClass(java.lang.Class) * @param interfaceClass The interface class to set. diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/ElementInterface.java b/x4o-driver/src/main/java/org/x4o/xml/element/ElementInterface.java index a067699..e3b3a52 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/ElementInterface.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/ElementInterface.java @@ -22,8 +22,6 @@ */ package org.x4o.xml.element; -import java.util.List; - /** * Defines an ElementInterface. * @@ -43,16 +41,4 @@ public interface ElementInterface extends ElementClassBase { * @param interfaceClass the interfaceClass to set. */ 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 getElementBindingHandlers(); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java b/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java index 764b467..baab8a2 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java +++ b/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java @@ -261,7 +261,6 @@ public class X4ODebugWriter { atts.addAttribute ("", "interfaceClass", "", "", elementInterface.getInterfaceClass().getName()); contentWriter.startElement (DEBUG_URI, "elementInterface", "", atts); - debugElementBindingHandler(elementInterface.getElementBindingHandlers()); debugElementClassBase(elementInterface); contentWriter.endElement(DEBUG_URI, "elementInterface", ""); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/DefaultX4OLanguage.java b/x4o-driver/src/main/java/org/x4o/xml/lang/DefaultX4OLanguage.java index db4195b..c606c2b 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/DefaultX4OLanguage.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/DefaultX4OLanguage.java @@ -181,9 +181,6 @@ public class DefaultX4OLanguage implements X4OLanguageLocal { X4OLanguageModule module = elementLanguageModules.get(i); findElementBindingHandlerInList(parent,null,result,module.getElementBindingHandlers(),false); } - for (ElementInterface ei:findElementInterfaces(parent)) { - findElementBindingHandlerInList(parent,null,result,ei.getElementBindingHandlers(),false); - } return result; } @@ -196,9 +193,6 @@ public class DefaultX4OLanguage implements X4OLanguageLocal { X4OLanguageModule module = elementLanguageModules.get(i); findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers(),true); } - for (ElementInterface ei:findElementInterfaces(parent)) { - findElementBindingHandlerInList(parent,child,result,ei.getElementBindingHandlers(),true); - } return result; } diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld b/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld index f00a9be..5df4b33 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld @@ -127,7 +127,6 @@ The class of the binding handler. - diff --git a/x4o-eld-doc/src/main/java/org/x4o/xml/eld/doc/EldDocWriter.java b/x4o-eld-doc/src/main/java/org/x4o/xml/eld/doc/EldDocWriter.java index d35b7c3..989d31c 100644 --- a/x4o-eld-doc/src/main/java/org/x4o/xml/eld/doc/EldDocWriter.java +++ b/x4o-eld-doc/src/main/java/org/x4o/xml/eld/doc/EldDocWriter.java @@ -141,7 +141,6 @@ public class EldDocWriter { adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_BINDING,ElementBindingHandler.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_BINDING,ElementBindingHandler.class)); adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_CONFIGURATOR,ElementConfigurator.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 (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface)); 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 (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespaceContext(ns)); for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec));