Package org.beanio.internal.config.xml
Class XmlMapping
- java.lang.Object
-
- org.beanio.internal.config.xml.XmlMapping
-
public class XmlMapping extends java.lang.ObjectStores parsing information about an XML mapping file.- Since:
- 1.2.1
- See Also:
XmlMappingParser
-
-
Constructor Summary
Constructors Constructor Description XmlMapping()Constructs a newXmlMapping.XmlMapping(java.lang.String name, java.lang.String location, XmlMapping parent)Constructs a newXmlMapping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddImport(XmlMapping child)Adds an imported mapping file to this mapping file.booleanaddTemplate(java.lang.String name, org.w3c.dom.Element element)Adds a template configuration to this mapping file.voidaddTypeHandlers(java.util.List<TypeHandlerConfig> list)Recursively adds type handlers from all imported mapping files, and from this mapping file, to a given list.org.w3c.dom.ElementfindTemplate(java.lang.String name)Recursively finds thetemplateDOM element for a given template name in this mapping file and its parents.BeanIOConfiggetConfiguration()Returns the BeanIO configuration for this mapping file.java.lang.StringgetLocation()Returns the location of this mapping file (in URL format).java.lang.StringgetName()Returns the name of this mapping file.XmlMappinggetParent()Returns the parent mapping file that imported this mapping file, ornullif this file is the "root" mapping file.java.util.PropertiesgetProperties()Returns the properties declared in this mapping file.booleanisDeclaredGlobalTypeHandler(java.lang.String name)Returns whether a global type handler was configured for the given type handler name.booleanisLoading(java.lang.String url)Returns whether a given mapping file is being actively loaded using its location to identify it.voidsetProperty(java.lang.String name, java.lang.String value)Sets a property declared in this mapping file.java.lang.StringtoString()
-
-
-
Constructor Detail
-
XmlMapping
public XmlMapping()
Constructs a newXmlMapping.
-
XmlMapping
public XmlMapping(java.lang.String name, java.lang.String location, XmlMapping parent)Constructs a newXmlMapping.- Parameters:
name- the mapping file name used for error messageslocation- 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 java.lang.String getName()
Returns the name of this mapping file.- Returns:
- the name of the mapping file
-
getLocation
public java.lang.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, ornullif 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(java.lang.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:
trueif the given location is being actively loaded, and thus the mapping file contains a circular reference
-
setProperty
public void setProperty(java.lang.String name, java.lang.String value)Sets a property declared in this mapping file.- Parameters:
name- the property namevalue- the property value
-
getProperties
public java.util.Properties getProperties()
Returns the properties declared in this mapping file.- Returns:
- the
Properties
-
addTypeHandlers
public void addTypeHandlers(java.util.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(java.lang.String name, org.w3c.dom.Element element)Adds a template configuration to this mapping file.- Parameters:
name- the name of the templateelement- the 'template' DOM element- Returns:
trueif the template was successfuly added, orfalseif the template name already existed
-
findTemplate
public org.w3c.dom.Element findTemplate(java.lang.String name)
Recursively finds thetemplateDOM 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(java.lang.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:
trueif a type handler was declared globally for the given name
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-