|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.config.xml.XmlMappingParser
public class XmlMappingParser
Parses a mapping file into a BeanIOConfig
object. A BeanIOConfig
is also produced for each mapping file imported by the mapping file being parsed,
and the entire collection is returned from loadConfiguration(InputStream)
.
This class is not thread safe and a new instance must be created for parsing each input stream.
Constructor Summary | |
---|---|
XmlMappingParser(XmlMappingReader reader)
Constructs a new XmlMappingParser. |
Method Summary | |
---|---|
protected void |
addProperties(BeanConfig beanConfig,
Element element)
Parses bean properties from the given DOM element. |
protected BeanConfig |
createBeanConfig(Element element)
Parses a bean configuration from a DOM element. |
protected Bean |
createBeanFactory(Element element)
Parses a Bean from a DOM element. |
protected BeanPropertyConfig |
createBeanPropertyConfig(Element element)
Parses a bean property configuration from a DOM element. |
protected FieldConfig |
createFieldConfig(Element element)
Parses a field configuration from a DOM element. |
protected GroupConfig |
createGroupConfig(Element element)
Parses a group configuration from a DOM element. |
protected TypeHandlerConfig |
createHandlerConfig(Element element)
Parses a TypeHandlerConfig from a DOM element. |
protected Properties |
createProperties(Element element)
Parses Properties from a DOM element. |
protected RecordConfig |
createRecordConfig(Element record)
Parses a record configuration from the given DOM element. |
protected StreamConfig |
createStreamConfig(Element element)
Parses a StreamConfig from a DOM element. |
protected void |
createTemplate(Element element)
Adds a template to the active mapping. |
protected XmlMapping |
getMapping()
Returns the mapping file information actively being parsed, which may change when one mapping file imports another. |
protected int |
getPositionOffset()
Returns the amount to offset a field position, which is calculated according to included template offset configurations. |
protected XmlMapping |
importConfiguration(Element element)
Parses an import DOM element and loads its mapping file. |
protected void |
includeTemplate(BeanConfig beanConfig,
Element element)
Includes a template. |
protected void |
includeTemplate(BeanConfig beanConfig,
String template,
int offset)
Includes a template. |
Collection<BeanIOConfig> |
loadConfiguration(InputStream in)
Reads a mapping file input stream and returns a collection of BeanIO configurations, one for the input stream and one for each imported mapping file (if specified). |
protected void |
loadMapping(Element element)
Parses a BeanIO configuration from a DOM element. |
protected void |
loadMapping(InputStream in)
Loads a mapping file from an input stream. |
protected void |
pop()
Completes the parsing of an imported mapping file. |
protected XmlMapping |
push(String name,
String location)
Initiates the parsing of an imported mapping file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlMappingParser(XmlMappingReader reader)
reader
- the XML mapping reader for reading XML mapping files
into a DOM objectMethod Detail |
---|
public Collection<BeanIOConfig> loadConfiguration(InputStream in) throws IOException, BeanIOConfigurationException
in
- the input stream to read
IOException
- if an I/O error occurs
BeanIOConfigurationException
- if the configuration is invalidprotected final XmlMapping push(String name, String location)
After parsing completes, pop()
must be invoked
before continuing.
name
- the name of the imported mapping filelocation
- the location of the imported mapping file
(this should be an absolute URL so that importing the
same mapping more than once can be detected)
getMapping()
)pop()
protected final void pop()
push(String, String)
protected final XmlMapping getMapping()
protected final int getPositionOffset()
protected void loadMapping(InputStream in) throws IOException
in
- the input stream to read
IOException
- if an I/O error occursprotected void loadMapping(Element element)
element
- the root 'beanio' DOM element to parseprotected final XmlMapping importConfiguration(Element element)
element
- the import DOM element
protected TypeHandlerConfig createHandlerConfig(Element element)
element
- the DOM element to parse
protected void createTemplate(Element element)
element
- the DOM element that defines the templateprotected Bean createBeanFactory(Element element)
element
- the DOM element to parse
protected Properties createProperties(Element element)
element
- the DOM element to parse
protected StreamConfig createStreamConfig(Element element)
element
- the stream DOM element to parse
protected GroupConfig createGroupConfig(Element element)
element
- the group DOM element to parse
protected RecordConfig createRecordConfig(Element record)
record
- the record DOM element to parse
protected void addProperties(BeanConfig beanConfig, Element element)
beanConfig
- the enclosing bean configuration to add the properties toelement
- the bean or record DOM element to parseprotected void includeTemplate(BeanConfig beanConfig, Element element)
beanConfig
- the parent bean configurationelement
- the include DOM element to parseprotected void includeTemplate(BeanConfig beanConfig, String template, int offset)
beanConfig
- the parent bean configurationtemplate
- the name of the template to includeoffset
- the value to offset configured positions byprotected BeanConfig createBeanConfig(Element element)
element
- the bean DOM element to parse
protected FieldConfig createFieldConfig(Element element)
element
- the field DOM element to parse
protected BeanPropertyConfig createBeanPropertyConfig(Element element)
element
- the property DOM element to parse
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |