Class BindingLoader


  • public final class BindingLoader
    extends java.lang.Object
    This class is responsible for loading a binding document into an in-memory representation that is meant to be used by the SourceGenerator.
    Version:
    $Revision: 7996 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
    Author:
    Arnaud Blandin
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  BindingLoader.BindingResolver
      EntityResolver specific to resolving entities related to the Castor XML code generator binding file.
    • Constructor Summary

      Constructors 
      Constructor Description
      BindingLoader()
      No-arg constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ExtendedBinding createBinding​(java.lang.String fileName)
      Factory method for unmarshalling an ExtendedBinding instance from the binding file as identified by the given file name.
      static ExtendedBinding createBinding​(org.xml.sax.InputSource source)
      Factory method that returns a binding given an InputSource.
      ExtendedBinding getBinding()
      Returns the binding loaded by the BindingLoader.
      void loadBinding​(java.lang.String url)
      Loads the binding file from the URL given, and populates the ExtendedBinding instance from the values given.
      void loadBinding​(org.xml.sax.InputSource source)
      Loads a Binding Document.
      void setBaseURL​(java.lang.String url)
      Sets the base URL for the binding and related files.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BindingLoader

        public BindingLoader()
        No-arg constructor.
    • Method Detail

      • loadBinding

        public void loadBinding​(java.lang.String url)
                         throws BindingException
        Loads the binding file from the URL given, and populates the ExtendedBinding instance from the values given.
        Parameters:
        url - The URL for the binding file to process.
        Throws:
        BindingException - If the binding file cannnot be processed properly.
      • loadBinding

        public void loadBinding​(org.xml.sax.InputSource source)
                         throws BindingException
        Loads a Binding Document. This method will load the binding document into a binding object and load all the included bindings along the way into a single collection.
        Parameters:
        source - The binding document to load.
        Throws:
        BindingException - thrown when an error occurred during the unmarshalling.
      • getBinding

        public ExtendedBinding getBinding()
        Returns the binding loaded by the BindingLoader.
        Returns:
        the binding loaded by this BindingLoader. This will return null if no call to loadBinding has been previously made.
      • setBaseURL

        public void setBaseURL​(java.lang.String url)
        Sets the base URL for the binding and related files. If the base URL is known, files can be included using relative names. Any URL can be passed, if the URL can serve as a base URL it will be used.
        Parameters:
        url - The base URL
      • createBinding

        public static ExtendedBinding createBinding​(org.xml.sax.InputSource source)
                                             throws BindingException
        Factory method that returns a binding given an InputSource. The InputSource identifies a Binding Document meant to be loaded.
        Parameters:
        source - the InputSource identifying the binding document to be loaded.
        Returns:
        a binding that contains the different component bindings to be used in the source generator.
        Throws:
        BindingException - thrown when the given InputSource doesn't refer to a valid Binding document.
      • createBinding

        public static ExtendedBinding createBinding​(java.lang.String fileName)
                                             throws BindingException
        Factory method for unmarshalling an ExtendedBinding instance from the binding file as identified by the given file name.
        Parameters:
        fileName - Binding file name.
        Returns:
        An ExtendedBinding instance populated from the given binding file (name).
        Throws:
        BindingException - If the binding file cannot be processed properly.