Interface XmlSerializable
- All Known Subinterfaces:
FileSink,FileSource,IFieldMapping
- All Known Implementing Classes:
AbstractFieldMapping,AbstractPipeline,AddFieldsAction,AggregateGroupFieldsAction,AmazonS3File,AmazonS3FileSink,AmazonS3FileSource,Attributes,AvroPipelineInput,AvroPipelineOutput,Bean,BinaryFieldDef,BloombergMessage,BooleanFieldDef,CalculatedField,Column,CompositePipelineAction,ConvertDateTimeToStringAction,ConvertNullToValueAction,ConvertNumberToStringAction,ConvertStringToBooleanAction,ConvertStringToDateTimeAction,ConvertStringToNumberAction,ConvertValueToStringAction,CopyFieldsAction,CsvPipelineInput,CsvPipelineOutput,DataMapping,DataMappingAction,DataMappingObject,DataMappingPart,DataMappingPipeline,DataMappingProblem,DataMappingResult,DataReaderPipelineInput,Dataset,DatasetPipelineInput,DataWriterPipelineOutput,DateTimePattern,DateTimePatternMatch,DecisionTable,DecisionTableAction,DecisionTableCondition,DecisionTableObject,DecisionTableOutcome,DecisionTableResult,DecisionTableRule,DecisionTree,DecisionTreeAction,DecisionTreeNode,DecisionTreeObject,DecisionTreeOutcome,DecisionTreeResult,Diff,EntityDef,EntityDefDiff,EntityRelationshipDef,EntityRelationshipDefDiff,ExcelPipelineInput,ExcelPipelineOutput,FieldDef,FieldDefDiff,FieldMapping,FieldPath,FileSinkPipelineOutput,FileSourcePipelineInput,FilterFieldExistsAction,FilterFieldMatchesPatternAction,FilterFieldNotNullAction,FilterMatchExpression,FixedWidthField,FixedWidthPipelineInput,FixedWidthPipelineOutput,FoundationObject,IndexDef,IndexDefDiff,IndexFieldDef,IndexFieldDefDiff,JdbcConnection,JdbcDataset,JdbcExportedKey,JdbcFieldIndex,JdbcImportedKey,JdbcIndex,JdbcPipelineInput,JdbcPipelineOutput,JdbcQuery,JdbcQueryColumn,JdbcQueryParameter,JdbcSchema,JdbcTable,JdbcTableColumn,JiraIssue,JiraSearch,JsonPipelineInput,JsonRecordPipelineInput,JsonRecordPipelineOutput,LatexPipelineOutput,LocalFile,LocalFileDataset,LocalFileSink,LocalFileSource,MemoryDataset,MicrosoftWordPipelineOutput,MvStoreDataset,NullPipeline,NumberDescriptor,NumberMatch,NumericFieldDef,OpenFinancialExchangePipelineInput,OrcPipelineInput,OrcPipelineOutput,ParquetPipelineInput,ParquetPipelineOutput,PdfPipelineInput,PdfPipelineOutput,Pipeline,PipelineAction,PipelineInput,PipelineObject,PipelineOutput,Property,PropertyDiff,ProxyFileSource,ProxyPipelineInput,ProxyPipelineOutput,RecordDiff,RecordFieldDef,RemoveDuplicatesAction,RenameFieldsAction,SchemaDef,SchemaDefDiff,SchemaObject,SchemaPart,SchemaProblem,SchemaValidationPath,SelectArrangeFieldsAction,ShopifyCustomerCriteria,ShopifyEventCriteria,ShopifyInventoryItem,ShopifyInventoryItemCriteria,ShopifyInventoryLevelCriteria,ShopifyOrder,ShopifyProductCriteria,ShopifyShippingAddress,SortFieldsAction,Tags,TemporalFieldDef,TextFieldDef,Tree,TreeNode,UuidFieldDef,ValidateFieldsExistsAction,ValidateFieldsMatchPatternAction,ValidateFieldsNotNullAction,ValidateMatchExpression,ValidationMessage,ValidationResult,XmlField,XmlPipelineInput,XmlRecordPipelineInput,XmlRecordPipelineOutput
public interface XmlSerializable
The interface implemented by classes to participate in serialization to and from XML.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEachGrandChildElement(Element parent, String childTagName, String grandchildTagName, Consumer<Element> grandChildElementConsumer) Passes eachgrandchildTagNameelement under the parent's firstchildTagNamechild to the consumer.default XmlSerializablefromXml(InputStream inputStream) Parses the XML in the stream and loads this object's state from its root element.default XmlSerializabledefault XmlSerializablefromXmlElement(Element element) static StringgetAttribute(Element element, String propertyName) Returns the attribute's value or null if it is missing or empty.static <T> TgetAttribute(Element element, String propertyName, FieldType fieldType) Returns the attribute converted to the field type's Java class or null if it is missing or blank.static <T> TgetAttribute(Element element, String propertyName, FieldType fieldType, T defaultValue) Returns the attribute converted to the field type's Java class or the default if it is missing or blank.static BooleangetAttribute(Element element, String propertyName, Boolean defaultValue) Returns true if the attribute istrueoryes(ignoring case), false for other text, or the default if it is missing or blank.static CharactergetAttribute(Element element, String propertyName, Character defaultValue) Returns the first character of the attribute or the default if it is missing or empty.static <T> TgetAttribute(Element element, String propertyName, Class<? extends T> cls) Returns the attribute converted to the given type (byte arrays from hex) or null if it is missing or blank.static <T> TgetAttribute(Element element, String propertyName, Class<? extends T> cls, T defaultValue) Returns the attribute converted to the given type (byte arrays from hex) or the default if it is missing or blank.static IntegergetAttribute(Element element, String propertyName, Integer defaultValue) Returns the attribute parsed as an integer or the default if it is missing or blank.static LonggetAttribute(Element element, String propertyName, Long defaultValue) Returns the attribute parsed as a long or the default if it is missing or blank.static StringgetAttribute(Element element, String propertyName, String defaultValue) Returns the attribute's value or the default if it is missing or empty.static ElementgetChildElement(Element parent, String childTagName) Returns the first direct child element with the given tag name, or null if there is none or the parent is null.getChildElements(Element parent, String childTagName) Returns the direct child elements with the given tag name; empty if there are none or the parent is null.static <T extends XmlSerializable>
TnewInstanceFromXml(InputStream inputStream) Parses the XML and instantiates the class named in the root element'sXML_SERIALIZED_CLASS_NAMEattribute, loading it from that element.static <T extends XmlSerializable>
TnewInstanceFromXml(Element element, Class<? super T> type) Instantiates the class named in the element'sXML_SERIALIZED_CLASS_NAMEattribute, which must be assignable totype, and loads it from the element; returns null for a null element.static voidsetAttribute(Element element, String name, Object value) Sets the attribute to the value's text, formatting dates, times and byte arrays (as hex); null or empty values are skipped.default StringtoXml()Returns this object as indented XML without an XML declaration.default StringtoXml(boolean addXml11Delcaration) Returns this object as indented XML, starting with an XML 1.1 declaration if requested.default XmlSerializableWrites this object as indented XML, without a declaration, to the writer and then closes it.default XmlSerializableWrites this object as indented XML, without a declaration, to the writer, closing it afterwards ifcloseWriteris true.default XmlSerializableWrites this object as indented XML to the writer, optionally starting with an XML 1.1 declaration and closing the writer afterwards.default ElementtoXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.static <T extends XmlSerializable>
TwriteXml(T bean, StreamResult outputTarget, boolean closeStream) Writes the bean'stoXmlElement(Document)as indented XML without a declaration, then flushes the target and closes it ifcloseStreamis true.static <T extends XmlSerializable>
TwriteXml(T bean, StreamResult outputTarget, boolean closeStream, boolean addXml11Delcaration)
-
Field Details
-
XML_SERIALIZED_CLASS_NAME
- See Also:
-
-
Method Details
-
toXmlElement
Returns an element, created withdocument, describing this object; the default implementation throws aDataException. -
fromXmlElement
-
toXml
Returns this object as indented XML without an XML declaration. -
toXml
Returns this object as indented XML, starting with an XML 1.1 declaration if requested. -
toXml
Writes this object as indented XML, without a declaration, to the writer and then closes it. -
toXml
Writes this object as indented XML, without a declaration, to the writer, closing it afterwards ifcloseWriteris true. -
toXml
Writes this object as indented XML to the writer, optionally starting with an XML 1.1 declaration and closing the writer afterwards. -
writeXml
static <T extends XmlSerializable> T writeXml(T bean, StreamResult outputTarget, boolean closeStream) Writes the bean'stoXmlElement(Document)as indented XML without a declaration, then flushes the target and closes it ifcloseStreamis true. -
writeXml
static <T extends XmlSerializable> T writeXml(T bean, StreamResult outputTarget, boolean closeStream, boolean addXml11Delcaration) -
fromXml
-
fromXml
Parses the XML in the stream and loads this object's state from its root element. -
setAttribute
Sets the attribute to the value's text, formatting dates, times and byte arrays (as hex); null or empty values are skipped. -
getAttribute
Returns the attribute's value or null if it is missing or empty. -
getAttribute
Returns the attribute's value or the default if it is missing or empty. -
getAttribute
Returns the first character of the attribute or the default if it is missing or empty. -
getAttribute
Returns true if the attribute istrueoryes(ignoring case), false for other text, or the default if it is missing or blank. -
getAttribute
Returns the attribute parsed as an integer or the default if it is missing or blank. -
getAttribute
Returns the attribute parsed as a long or the default if it is missing or blank. -
getAttribute
Returns the attribute converted to the given type (byte arrays from hex) or null if it is missing or blank. -
getAttribute
static <T> T getAttribute(Element element, String propertyName, Class<? extends T> cls, T defaultValue) Returns the attribute converted to the given type (byte arrays from hex) or the default if it is missing or blank. -
getAttribute
Returns the attribute converted to the field type's Java class or null if it is missing or blank. -
getAttribute
static <T> T getAttribute(Element element, String propertyName, FieldType fieldType, T defaultValue) Returns the attribute converted to the field type's Java class or the default if it is missing or blank. -
getChildElement
Returns the first direct child element with the given tag name, or null if there is none or the parent is null. -
getChildElements
Returns the direct child elements with the given tag name; empty if there are none or the parent is null. -
forEachGrandChildElement
static void forEachGrandChildElement(Element parent, String childTagName, String grandchildTagName, Consumer<Element> grandChildElementConsumer) Passes eachgrandchildTagNameelement under the parent's firstchildTagNamechild to the consumer. -
newInstanceFromXml
Instantiates the class named in the element'sXML_SERIALIZED_CLASS_NAMEattribute, which must be assignable totype, and loads it from the element; returns null for a null element. -
newInstanceFromXml
Parses the XML and instantiates the class named in the root element'sXML_SERIALIZED_CLASS_NAMEattribute, loading it from that element.
-