|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.apl.jxc.mapper.AbstractXMLMapping
public abstract class AbstractXMLMapping
Encapsulates the mapping of an XML element to another schema.
XMLControl
,
XMLDefault
,
XMLMapping
Constructor Summary | |
---|---|
protected |
AbstractXMLMapping(java.lang.String sourcePath,
java.lang.String targetPath,
java.lang.String condition,
XSLTFunction function,
java.lang.String defaultValue)
Constructs a new AbstractXMLMapping. |
Method Summary | |
---|---|
boolean |
conditionsEqual(AbstractXMLMapping mapping)
Returns true if the conditon attribute of this mapping is equal to the condition attribute of the mapping argument. |
static AbstractXMLMapping |
create(java.lang.String sourcePath,
java.lang.String targetPath,
java.lang.String condition,
XSLTFunction function,
java.lang.String defaultValue)
Factory method that returns the most appropriate AbstractXMLMapping sub-class for the specified arguments. |
java.lang.String |
getCondition()
Returns the XPath mapping condition. |
java.lang.String |
getDefaultValue()
Returns a literal value to be output instead of the data selected from sourcePath in the source schema. |
XSLTFunction |
getFunction()
Returns the XSLT function to be applied to the mapping. |
java.lang.String |
getSelectString(java.lang.String currentContext)
Returns a String suitable for an XSL select attribute based on the specified context. |
java.lang.String |
getSourcePath()
Returns the path to and including the element or attribute in the source schema. |
java.lang.String |
getTargetElementName()
Returns the name of the mapped element in the target schema. |
java.lang.String |
getTargetPath()
Returns the path to and including the element or attribute in the target schema. |
boolean |
isAttribute()
Determines if the mapping is to an attribute. |
boolean |
isConditional()
Returns a boolean indicating whether the mapping is conditional or not. |
abstract boolean |
isDefault()
When true the value of sourcePath will be defaulted as a literal value into the target instead of being used to select from the source schema. |
boolean |
isEmpty()
Returns true if this is an empty mapping, i.e. |
boolean |
isRootElement()
Returns true if the mapping is for the root element, otherwise false. |
boolean |
isTargetAttributeOrLeaf(java.util.List<AbstractXMLMapping> allMappings)
Returns true mapping to an attribute or leaf element in the target schema. |
boolean |
targetsEqual(AbstractXMLMapping mapping)
Returns true if the conditon attribute of this mapping is equal to the condition attribute of the mapping argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractXMLMapping(java.lang.String sourcePath, java.lang.String targetPath, java.lang.String condition, XSLTFunction function, java.lang.String defaultValue)
sourcePath
- path to and including the element or attribute in the
source schematargetPath
- path to and including the element or attribute in the
target schemacondition
- a boolean XPath condition for the mapping, the mapping
will only be performed if the condition evaluates to truefunction
- an XPath function to be applied to the mappingdefaultValue
- a literal value to be output instead of the data
selected from sourcePath in the source schema
InvalidMappingException
- if an attempt is made to construct an
AbstractXMLMapping from invalid argumentscreate(java.lang.String, java.lang.String, java.lang.String, uk.apl.jxc.XSLTFunction, java.lang.String)
Method Detail |
---|
public java.lang.String getSelectString(java.lang.String currentContext)
This method works according to the table below:
sourcePath | currentContext | function | result |
myroot/mytype/myelement | myroot/mytype/ | myelement | |
myroot/mytype/myelement | myroot/ | .//myelement | |
myroot/mytype/myelement | myroot/ | sum | sum(.//myelement) |
This allows a read ahead capability
currentContext
- current context of the mapping
public final java.lang.String getTargetPath()
public java.lang.String getCondition()
public XSLTFunction getFunction()
public final boolean isRootElement()
public boolean isTargetAttributeOrLeaf(java.util.List<AbstractXMLMapping> allMappings)
allMappings
- list of all mappings used in the mapping
public boolean isAttribute()
public java.lang.String getTargetElementName()
I.e. without including the path to id.
public java.lang.String getSourcePath()
public boolean isConditional()
public abstract boolean isDefault()
public java.lang.String getDefaultValue()
public final boolean isEmpty()
public boolean conditionsEqual(AbstractXMLMapping mapping)
mapping
- the mapping whose conditon is to be compared
public boolean targetsEqual(AbstractXMLMapping mapping)
mapping
- the mapping whose conditon is to be compared
public static AbstractXMLMapping create(java.lang.String sourcePath, java.lang.String targetPath, java.lang.String condition, XSLTFunction function, java.lang.String defaultValue)
defaultValue | targetPath | sourcePath | Returns |
Yes | Yes | Yes | InvalidMappingException |
No | Yes | No | InvalidMappingException |
No | No | Yes | InvalidMappingException |
No | No | Yes | XMLControl |
Yes | Yes | No | XMLDefault |
No | Yes | Yes | XMLMapping |
sourcePath
- path to and including the element or attribute in the
source schematargetPath
- path to and including the element or attribute in the
target schemacondition
- a boolean XPath condition for the mapping, the mapping
will only be performed if the condition evaluates to truefunction
- an XPath function to be applied to the mappingdefaultValue
- a literal value to be output instead of the data
selected from sourcePath in the source schema
XMLControl
,
XMLDefault
,
XMLMapping
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |