Class 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 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 - 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 (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 - 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