org.jibx.binding.model
Class BindingHolder

java.lang.Object
  extended by 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
BindingHolder(String uri, boolean dflt, BindingOrganizer dir)
          Constructor.
 
Method Summary
 void addFormat(FormatElement format)
          Add a format definition to the binding.
 void addMapping(MappingElementBase mapping)
          Add a mapping definition to the binding.
 void addNamespaceUsage(String uri)
          Add usage of namespace for an element or attribute name in binding.
 void addTypeNameReference(String uri, Object obj)
          Add reference from this binding to a type name defined in the same or another binding.
 BindingElement getBinding()
          Get the binding element.
 String getElementDefaultNamespace()
          Get default namespace URI for elements defined in this binding.
 String getFileName()
          Get the file name to be used for this file.
 int getMappingCount()
          Get the number of mapping definitions present in this binding.
 String getNamespace()
          Get namespace URI associated with this binding.
 String getPrefix()
          Get namespace prefix for this binding.
 BindingHolder getRequiredBinding(Object obj)
          Get the binding associated with a particular control object.
 Iterator iterateMappings()
          Get the number of mapping definitions present in this binding.
 void setBinding(BindingElement bind)
          Set the binding element.
 void setFileName(String name)
          Set the file name to be used for this file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 - (null if no-namespace binding)
dflt - namespace is default for elements flag
dir - directory managing this holder
Method Detail

getNamespace

public String getNamespace()
Get namespace URI associated with this binding.

Returns:
namespace (null if no-namespace)

getPrefix

public String getPrefix()
Get namespace prefix for this binding.

Returns:
prefix (null if not specified)

getElementDefaultNamespace

public String getElementDefaultNamespace()
Get default namespace URI for elements defined in this binding.

Returns:
namespace (null if 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 -

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 -

addNamespaceUsage

public void addNamespaceUsage(String uri)
Add usage of namespace for an element or attribute name in binding.

Parameters:
uri - referenced namespace URI (null if 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 name
obj - object associated with referenced binding

getFileName

public String getFileName()
Get the file name to be used for this file.

Returns:
name (null if not set)

setFileName

public void setFileName(String name)
Set the file name to be used for this file.

Parameters:
name -

addMapping

public void addMapping(MappingElementBase mapping)
Add a mapping definition to the binding.

Parameters:
mapping -

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


Copyright © 2005-2011 jibx.org. All Rights Reserved.