Class XmlField
java.lang.Object
com.northconcepts.datapipeline.xml.XmlField
- All Implemented Interfaces:
JsonSerializable,RecordSerializable,XmlSerializable
Maps the values found at a location path to a named record field for
XmlReader, optionally cascading the
last value into later records.-
Field Summary
Fields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
ConstructorsConstructorDescriptionXmlField()Creates a field read from the location path; withcascadeValues, its last value carries over to later records until a new match replaces it.Creates a cascading field whose carried-over value is cleared by elements matchingcascadeResetLocationPath; a null or empty reset path turns cascading off. -
Method Summary
Modifier and TypeMethodDescriptionprotected XmlFieldRecords a value matched at the node with the given sequence number.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element xmlFieldElement) LocationPathReturns the location path whose matching elements clear the cascaded value, or null if none is set.LocationPathgetName()protected LinkedList<<any>> Returns the values recorded for this field, each paired with the sequence number of the node it came from.booleanIndicates if this field's last value carries over to later records until a new match replaces it (default is false).protected XmlFieldremoveValues(long sequence) Removes the most recently recorded values whose node sequence number is at leastsequence.setCascadeResetLocationPath(LocationPath cascadeResetLocationPath) Sets the location path whose matching elements clear the cascaded value; unlike theStringoverload, it leavesisCascadeValues()unchanged.setCascadeValues(boolean cascadeValues) Indicates if this field's last value carries over to later records until a new match replaces it (default is false).toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toString()toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
XmlField
public XmlField() -
XmlField
Creates a field read from the location path; withcascadeValues, its last value carries over to later records until a new match replaces it. -
XmlField
Creates a cascading field whose carried-over value is cleared by elements matchingcascadeResetLocationPath; a null or empty reset path turns cascading off.
-
-
Method Details
-
getName
-
setName
-
getLocationPath
public LocationPath getLocationPath() -
isCascadeValues
public boolean isCascadeValues()Indicates if this field's last value carries over to later records until a new match replaces it (default is false). -
setCascadeValues
Indicates if this field's last value carries over to later records until a new match replaces it (default is false). -
getCascadeResetLocationPath
public LocationPath getCascadeResetLocationPath()Returns the location path whose matching elements clear the cascaded value, or null if none is set. -
setCascadeResetLocationPath
Sets the location path whose matching elements clear the cascaded value; unlike theStringoverload, it leavesisCascadeValues()unchanged. -
getValues
Returns the values recorded for this field, each paired with the sequence number of the node it came from. -
addValue
Records a value matched at the node with the given sequence number. -
removeValues
Removes the most recently recorded values whose node sequence number is at leastsequence. -
toString
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable
-