Package aQute.lib.xmldtoparser
Class DomDTOParser
- java.lang.Object
-
- aQute.lib.xmldtoparser.DomDTOParser
-
public class DomDTOParser extends java.lang.Object
Parse an XML file based on a DTO as schema
-
-
Constructor Summary
Constructors Constructor Description DomDTOParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
parse(java.lang.Class<T> type, java.io.File doc)
parse the given XML file based on the type as the schema.static <T> T
parse(java.lang.Class<T> type, java.io.InputStream doc)
parse the given XML file based on the type as the schema.
-
-
-
Method Detail
-
parse
public static <T> T parse(java.lang.Class<T> type, java.io.File doc) throws java.lang.Exception
parse the given XML file based on the type as the schema. Attributes and elements are mapped to fields in an object of this type. If the field is a collection or a DTO type, the parse will be recursive.- Parameters:
type
- the type acting as schemedoc
- the file- Returns:
- a DTO of type
- Throws:
java.lang.Exception
-
parse
public static <T> T parse(java.lang.Class<T> type, java.io.InputStream doc) throws java.lang.Exception
parse the given XML file based on the type as the schema. Attributes and elements are mapped to fields in an object of this type. If the field is a collection or a DTO type, the parse will be recursive.- Parameters:
type
- the type acting as schemedoc
- the file- Returns:
- a DTO of type
- Throws:
java.lang.Exception
-
-