Package org.jibx.binding.model
Class BindingHolder
- java.lang.Object
-
- org.jibx.binding.model.BindingHolder
-
public class BindingHolder extends Object
External data for a binding definition. Along with the actual mapping definitions, this tracks namespace references and usages.- Author:
- Dennis M. Sosnoski
-
-
Constructor Summary
Constructors Constructor Description BindingHolder(String uri, boolean dflt, BindingOrganizer dir)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFormat(FormatElement format)Add a format definition to the binding.voidaddMapping(MappingElementBase mapping)Add a mapping definition to the binding.voidaddNamespaceUsage(String uri)Add usage of namespace for an element or attribute name in binding.voidaddTypeNameReference(String uri, Object obj)Add reference from this binding to a type name defined in the same or another binding.BindingElementgetBinding()Get the binding element.StringgetElementDefaultNamespace()Get default namespace URI for elements defined in this binding.StringgetFileName()Get the file name to be used for this file.intgetMappingCount()Get the number of mapping definitions present in this binding.StringgetNamespace()Get namespace URI associated with this binding.StringgetPrefix()Get namespace prefix for this binding.BindingHoldergetRequiredBinding(Object obj)Get the binding associated with a particular control object.IteratoriterateMappings()Get the number of mapping definitions present in this binding.voidsetBinding(BindingElement bind)Set the binding element.voidsetFileName(String name)Set the file name to be used for this file.
-
-
-
Constructor Detail
-
BindingHolder
public BindingHolder(String uri, boolean dflt, BindingOrganizer dir)
Constructor. TODO: add a way of handling pregenerated bindings, so that namespaces can be properly tracked?- Parameters:
uri- (nullif no-namespace binding)dflt- namespace is default for elements flagdir- directory managing this holder
-
-
Method Detail
-
getNamespace
public String getNamespace()
Get namespace URI associated with this binding.- Returns:
- namespace (
nullif no-namespace)
-
getPrefix
public String getPrefix()
Get namespace prefix for this binding.- Returns:
- prefix (
nullif not specified)
-
getElementDefaultNamespace
public String getElementDefaultNamespace()
Get default namespace URI for elements defined in this binding.- Returns:
- namespace (
nullif no-namespace)
-
getBinding
public BindingElement getBinding()
Get the binding element.- Returns:
- binding
-
setBinding
public void setBinding(BindingElement bind)
Set the binding element. This method is provided so that the generated binding element can be replaced by one which has been read in from a file after being written.- Parameters:
bind- Binding Element
-
addFormat
public void addFormat(FormatElement format)
Add a format definition to the binding. In actual generation, formats may be moved to a root binding definition.- Parameters:
format- element
-
addNamespaceUsage
public void addNamespaceUsage(String uri)
Add usage of namespace for an element or attribute name in binding.- Parameters:
uri- referenced namespace URI (nullif no-namespace)
-
addTypeNameReference
public void addTypeNameReference(String uri, Object obj)
Add reference from this binding to a type name defined in the same or another binding.- Parameters:
uri- namespace URI for type nameobj- object associated with referenced binding
-
getFileName
public String getFileName()
Get the file name to be used for this file.- Returns:
- name (
nullif not set)
-
setFileName
public void setFileName(String name)
Set the file name to be used for this file.- Parameters:
name- Name
-
addMapping
public void addMapping(MappingElementBase mapping)
Add a mapping definition to the binding.- Parameters:
mapping- element base
-
getMappingCount
public int getMappingCount()
Get the number of mapping definitions present in this binding.- Returns:
- count
-
iterateMappings
public Iterator iterateMappings()
Get the number of mapping definitions present in this binding.- Returns:
- count
-
getRequiredBinding
public BindingHolder getRequiredBinding(Object obj)
Get the binding associated with a particular control object.- Parameters:
obj- object associated with binding (can be namespace URI, if only one binding per namespace)- Returns:
- binding holder
-
-