| |
|
| java.lang.Object org.jibx.binding.def.DefinitionContext
DefinitionContext | public class DefinitionContext (Code) | | Nesting level for definitions in binding. This tracks namespace and mapping
definitions that apply to all enclosed items.
author: Dennis M. Sosnoski version: 1.0 |
DefinitionContext | public DefinitionContext(IContainer contain)(Code) | | Constructor. Uses the containing context to establish the hierarchy for
resolving namespaces and class mappings.
Parameters: contain - containing binding definition component |
addConversion | public void addConversion(QName name, StringConversion conv) throws JiBXException(Code) | | Add named conversion. Checks for duplicate conversions defined within
a level with the same name.
Parameters: name - format name for this conversion Parameters: conv - conversion definition for class throws: JiBXException - if duplicate conversion definition |
addImpliedNamespace | public void addImpliedNamespace(NamespaceDefinition def) throws JiBXException(Code) | | Add namespace declaration to set defined at this level. This method
treats all namespaces as though they were declared with default="none".
If the new namespace prefix conflicts with an existing namespace this
throws an exception.
Parameters: def - namespace definition to be added (duplicates ignored) throws: JiBXException - on namespace definition conflict |
addMapping | public void addMapping(IMapping def) throws JiBXException(Code) | | Add class mapping to set defined at this level. If the new mapping
conflicts with an existing one at this level it throws an exception.
Parameters: def - mapping definition to be added throws: JiBXException - on mapping definition conflict |
addNamedStructure | public void addNamedStructure(String name, IComponent comp) throws JiBXException(Code) | | Add named structure component to set defined at this level. If the name
conflicts with an existing one at this level it throws an exception.
Parameters: name - component name to be set Parameters: comp - named component throws: JiBXException - on mapping definition conflict |
addNamespace | public void addNamespace(NamespaceDefinition def) throws JiBXException(Code) | | Add namespace to set defined at this level. If the new namespace
conflicts with an existing namespace at this level (in terms of default
usage or prefix) this throws an exception.
Parameters: def - namespace definition to be added (duplicates ignored) throws: JiBXException - on namespace definition conflict |
genLoadNamespaces | public void genLoadNamespaces(MethodBuilder mb)(Code) | | Generate code for loading namespace index and URI arrays. The code
creates the arrays and leaves the references on the stack.
Parameters: mb - method builder for generated code |
generateCode | public void generateCode(boolean verbose, boolean force) throws JiBXException(Code) | | Generate code. Executes code generation for each top-level mapping
defined in this binding, which in turn propagates the code generation
all the way down.
Parameters: verbose - flag for verbose output Parameters: force - create marshaller/unmarshaller even for abstract non-basemappings flag throws: JiBXException - if error in transformation |
getClassMapping | public IMapping getClassMapping(String name)(Code) | | Get mapping definition for class. Finds the mapping for a fully
qualified class name, throwing an exception if no mapping is defined.
This can only be used during the linkage phase.
Parameters: name - fully qualified class name mapping definition for class, or null if not defined |
getConversion | public StringConversion getConversion(ClassFile clas)(Code) | | Get conversion definition for class. Finds the conversion based on a
fully qualified class name. If a specific conversion for the actual
class is not found (either in this or a containing level) this returns
the generic object conversion.
Parameters: clas - information for target conversion class conversion definition for class |
getDefaultIndex | public int getDefaultIndex(boolean attr)(Code) | | Get the default namespace index for a contained name. Elements and
attributes are treated separately, since namespace handling differs
between the two.
Parameters: attr - flag for attribute name default namespace index |
getDefaultURI | public String getDefaultURI(boolean attr)(Code) | | Get the default namespace URI for a contained name. Elements and
attributes are treated separately, since namespace handling differs
between the two.
Parameters: attr - flag for attribute name default namespace URI, or null if none |
getMappingAtLevel | public IMapping getMappingAtLevel(String name)(Code) | | Get mapping definition for class if defined at this level.
Parameters: name - fully qualified class name mapping definition for class, or null if not defined |
getMappings | public ArrayList getMappings()(Code) | | Get mapping definitions at level.
mapping definitions, null if none defined at level |
getNamedConversion | public StringConversion getNamedConversion(QName name)(Code) | | Get named conversion definition. Finds the conversion with the supplied
name, checking the containing definitions if the conversion is not found
at this level.
Parameters: name - conversion name to be found conversion definition for class |
getNamedStructure | public IComponent getNamedStructure(String name) throws JiBXException(Code) | | Get nested structure by name. Finds the nested structure with the given
name, throwing an exception if no component with that name is defined.
Parameters: name - component name to be found component with given name throws: JiBXException - if name not defined |
getNamespaceIndex | public int getNamespaceIndex(String uri, boolean attr) throws JiBXException(Code) | | Get namespace index for a given URI. Finds the prefix for a URI in a
name contained by this level, throwing an exception if the URI is not
found or does not have a prefix.
Parameters: uri - namespace URI to be found Parameters: attr - flag for attribute name namespace index for URI throws: JiBXException - if URI not defined or not usable |
getNamespaces | public ArrayList getNamespaces()(Code) | | Get the namespaces defined in this context
namespace definitions (may be null if none) |
getSpecificConversion | public StringConversion getSpecificConversion(String name)(Code) | | Get specific conversion definition for type. Finds with an exact match
on the class name, checking the containing definitions if a conversion
is not found at this level.
Parameters: name - fully qualified class name to be converted conversion definition for class, or null if notfound |
hasNamespace | public boolean hasNamespace()(Code) | | Check if one or more namespaces are defined in this context.
true if namespaces are defined, false if not |
linkMappings | public void linkMappings() throws JiBXException(Code) | | Links extension mappings to their base mappings. This must be done before
the more general linking step in order to determine which abstract
mappings are standalone and which are extended by other mappings
throws: JiBXException - if error in linking |
print | public void print(int depth)(Code) | | |
setConversion | public void setConversion(StringConversion conv) throws JiBXException(Code) | | Set specific conversion definition for type. Sets the conversion based
on a type signature, checking for duplicate conversions defined within
a level.
Parameters: conv - conversion definition for class throws: JiBXException - if duplicate conversion definition |
setDefaultConversion | public void setDefaultConversion(QName name, StringConversion conv) throws JiBXException(Code) | | Sets a conversion definition by both type and name. Both the type and
name are checked for duplicate conversions defined within a level.
Parameters: name - format name for this conversion Parameters: conv - conversion definition for class throws: JiBXException - if duplicate conversion definition |
setLinkages | public void setLinkages() throws JiBXException(Code) | | Set linkages between binding components. This is called after all the
basic information has been set up. All linkage to higher level
components should be done by this method, in order to prevent problems
due to the order of definitions between components. For the definition
context this calls the same method on all mappings defined in this
context.
throws: JiBXException - if error in configuration |
setNamedConversion | public void setNamedConversion(QName name, StringConversion conv) throws JiBXException(Code) | | Sets a named conversion definition.
Parameters: name - format name for this conversion Parameters: conv - conversion definition for class throws: JiBXException - if duplicate conversion definition |
|
|
|