BeanIO 2.0.4

org.beanio.internal.config.xml
Class XmlMapping

java.lang.Object
  extended by org.beanio.internal.config.xml.XmlMapping

public class XmlMapping
extends Object

Stores parsing information about an XML mapping file.

Since:
1.2.1
Author:
Kevin Seim
See Also:
XmlMappingParser

Constructor Summary
XmlMapping()
          Constructs a new XmlMapping.
XmlMapping(String name, String location, XmlMapping parent)
          Constructs a new XmlMapping.
 
Method Summary
 void addImport(XmlMapping child)
          Adds an imported mapping file to this mapping file.
 boolean addTemplate(String name, Element element)
          Adds a template configuration to this mapping file.
 void addTypeHandlers(List<TypeHandlerConfig> list)
          Recursively adds type handlers from all imported mapping files, and from this mapping file, to a given list.
 Element findTemplate(String name)
          Recursively finds the template DOM element for a given template name in this mapping file and its parents.
 BeanIOConfig getConfiguration()
          Returns the BeanIO configuration for this mapping file.
 String getLocation()
          Returns the location of this mapping file (in URL format).
 String getName()
          Returns the name of this mapping file.
 XmlMapping getParent()
          Returns the parent mapping file that imported this mapping file, or null if this file is the "root" mapping file.
 Properties getProperties()
          Returns the properties declared in this mapping file.
 boolean isDeclaredGlobalTypeHandler(String name)
          Returns whether a global type handler was configured for the given type handler name.
 boolean isLoading(String url)
          Returns whether a given mapping file is being actively loaded using its location to identify it.
 void setProperty(String name, String value)
          Sets a property declared in this mapping file.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlMapping

public XmlMapping()
Constructs a new XmlMapping.


XmlMapping

public XmlMapping(String name,
                  String location,
                  XmlMapping parent)
Constructs a new XmlMapping.

Parameters:
name - the mapping file name used for error messages
location - the location of the mapping (this should be the absolute URL location of the file so that the same mapping file will always have the same the location)
parent - the parent mapping
Method Detail

getName

public String getName()
Returns the name of this mapping file.

Returns:
the name of the mapping file

getLocation

public String getLocation()
Returns the location of this mapping file (in URL format).

Returns:
the absolute URL location of this mapping file

getConfiguration

public BeanIOConfig getConfiguration()
Returns the BeanIO configuration for this mapping file.

Returns:
the BeanIO configuration

getParent

public XmlMapping getParent()
Returns the parent mapping file that imported this mapping file, or null if this file is the "root" mapping file.

Returns:
the parent mapping file

addImport

public void addImport(XmlMapping child)
Adds an imported mapping file to this mapping file.

Parameters:
child - the imported mapping file

isLoading

public boolean isLoading(String url)
Returns whether a given mapping file is being actively loaded using its location to identify it. This is used for detecting circular references.

Parameters:
url - the mapping file location to check
Returns:
true if the given location is being actively loaded, and thus the mapping file contains a circular reference

setProperty

public void setProperty(String name,
                        String value)
Sets a property declared in this mapping file.

Parameters:
name - the property name
value - the property value

getProperties

public Properties getProperties()
Returns the properties declared in this mapping file.

Returns:
the Properties

addTypeHandlers

public void addTypeHandlers(List<TypeHandlerConfig> list)
Recursively adds type handlers from all imported mapping files, and from this mapping file, to a given list.

Parameters:
list - the list to add all type handlers too

addTemplate

public boolean addTemplate(String name,
                           Element element)
Adds a template configuration to this mapping file.

Parameters:
name - the name of the template
element - the 'template' DOM element
Returns:
true if the template was successfuly added, or false if the template name already existed

findTemplate

public Element findTemplate(String name)
Recursively finds the template DOM element for a given template name in this mapping file and its parents.

Parameters:
name - the name of the template to retrieve
Returns:
the matching template Element

isDeclaredGlobalTypeHandler

public boolean isDeclaredGlobalTypeHandler(String name)
Returns whether a global type handler was configured for the given type handler name. Recursively checks all imported mapping files.

Parameters:
name - the type handler name
Returns:
true if a type handler was declared globally for the given name

toString

public String toString()
Overrides:
toString in class Object

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim