Package org.goplanit.io.xml.util
Class PlanitXmlJaxbParser<T>
- java.lang.Object
-
- org.goplanit.io.xml.util.PlanitXmlJaxbParser<T>
-
public class PlanitXmlJaxbParser<T> extends Object
Serves as a base class for readers of PLANit XML files of which the root element is of type T- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_XML_FILE_EXTENSIONDefault extension for XML input files
-
Constructor Summary
Constructors Constructor Description PlanitXmlJaxbParser(Class<T> clazz)location of where to collect XML file and populate an instance of provided classPlanitXmlJaxbParser(T xmlRootElement)Constructor where root element is already provided and assumed to be populated as well
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearXmlContent()mark the xml root element for garbage collectionstatic org.opengis.referencing.crs.CoordinateReferenceSystemcreatePlanitCrs(String srsName)Create a crs based on passed in srs name.TgetXmlRootElement()Collect the root element of this readerbooleaninitialiseAndParseXmlRootElement(String inputPathDirectory, String xmlFileExtension)Parse the raw XML root (and rest) from file if not already set via constructorvoidsetXmlRootElement(T xmlRootElement)Set the root element of this reader
-
-
-
Field Detail
-
DEFAULT_XML_FILE_EXTENSION
public static final String DEFAULT_XML_FILE_EXTENSION
Default extension for XML input files- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlanitXmlJaxbParser
public PlanitXmlJaxbParser(Class<T> clazz)
location of where to collect XML file and populate an instance of provided class- Parameters:
clazz- to create root element and populate it for
-
PlanitXmlJaxbParser
public PlanitXmlJaxbParser(T xmlRootElement)
Constructor where root element is already provided and assumed to be populated as well- Parameters:
xmlRootElement- to use
-
-
Method Detail
-
initialiseAndParseXmlRootElement
public boolean initialiseAndParseXmlRootElement(String inputPathDirectory, String xmlFileExtension) throws PlanItException
Parse the raw XML root (and rest) from file if not already set via constructor- Parameters:
inputPathDirectory- to usexmlFileExtension- to use- Returns:
- true when success, false when something was parsed but no appropriate match could be found
- Throws:
PlanItException- thrown if error
-
createPlanitCrs
public static org.opengis.referencing.crs.CoordinateReferenceSystem createPlanitCrs(String srsName) throws PlanItException
Create a crs based on passed in srs name. If no srs name is provided the default will be created- Parameters:
srsName- to use- Returns:
- craeted crs
- Throws:
PlanItException- thrown if error
-
getXmlRootElement
public T getXmlRootElement()
Collect the root element of this reader- Returns:
- root element
-
setXmlRootElement
public void setXmlRootElement(T xmlRootElement)
Set the root element of this reader- Parameters:
xmlRootElement- to use
-
clearXmlContent
public void clearXmlContent()
mark the xml root element for garbage collection
-
-