package org.madore.damlengine; import java.util.Map; import java.util.HashMap; import org.w3c.dom.Element; import org.w3c.dom.Attr; public abstract class TodoAttr extends TodoItem { public static abstract class Factory { public abstract TodoAttr newItem(Attr attr, Element owner, Map context, Map options); } protected static Map damlAttrFactories; static { damlAttrFactories = new HashMap(); damlAttrFactories.put("xempty", new TodoXemptyAttr.Factory()); } Attr attr; Element owner; Map context; Map options; public TodoAttr(Attr attr, Element owner, Map context, Map options) { this.attr = attr; this.owner = owner; this.context = context; this.options = options; } public static TodoAttr getTodoAttr(Attr attr, Element owner, Map context, Map options) { Factory factory = null; String nsuri = attr.getNamespaceURI(); if ( nsuri != null && nsuri.equals(DamlEngine.DAML_NS) ) factory = damlAttrFactories.get(attr.getLocalName()); if ( factory == null ) return null; return factory.newItem(attr, owner, context, options); } }