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.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);

View file

@ -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);
}

View file

@ -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<ElementBindingHandler> elementBindingHandlers = null;
/**
* Creates 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;
}
/**
* @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.

View file

@ -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<ElementBindingHandler> getElementBindingHandlers();
}

View file

@ -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", "");
}

View file

@ -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;
}

View file

@ -127,7 +127,6 @@
<description>The class of the binding handler.</description>
</attribute>
<elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/>
<elementParent tag="elementInterface"/>
</element>
<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));
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));