public class Helper extends Object
| Modifier and Type | Field and Description |
|---|---|
protected MarshalXML |
marshaller |
| Constructor and Description |
|---|
Helper() |
| Modifier and Type | Method and Description |
|---|---|
Element |
AddAnyElement(List<Element> ellist,
String name,
String value)
Given an element list, adds a new element and value to the list
|
static void |
createElement(Object o,
String field)
Create specified element within a JAXB schema representation
Any of the elements children that are required will also be created
|
static void |
createRequiredElements(Object o)
Finds and creates required elements within an JAXB schema representation
|
private static boolean |
hasDefaultConstructor(Class<?> a_class)
Check if a class has a default constructor
|
static XMLGregorianCalendar |
timestamp(BigInteger year,
int month,
int day,
int hour,
int minute,
int second,
BigDecimal fractionalSecond,
int timezone)
Create a timestamp object suitable for setting any XML field with a type of xs:DateTime
Use of BigDecimal allows arbitrary precision for fractional seconds.
|
static XMLGregorianCalendar |
timestamp(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
int timezone)
Create a timestamp object suitable for setting any XML field with a type of xs:DateTime
|
static XMLGregorianCalendar |
timestamp(String tstamp)
Create a timestamp object suitable for setting any XML field with a type of xs:DateTime
|
static BigDecimal |
toXsDecimal(double d)
XML xs:decimal type is implemented in JAXB as a BigDecimal
This routine converts a Java double to a big decimal
|
static Double |
toXsDouble(double d)
XML xs:double type is implemented in JAXB as a Double
This routine converts a Java double to a Double
|
static BigInteger |
toXsInteger(long n)
XML xs:Integer type is implemented in JAXB as a BigInteger
This routine converts a Java long to a BigInteger
|
protected MarshalXML marshaller
public Helper()
throws JAXBException
JAXBExceptionpublic static void createRequiredElements(Object o) throws IllegalArgumentException, IllegalAccessException, InstantiationException
o - Required elements will be created for this objectIllegalArgumentException - illegal argumentIllegalAccessException - illegal accessInstantiationException - unable to instantiatepublic static void createElement(Object o, String field) throws IllegalArgumentException, IllegalAccessException, InstantiationException
o - Specified field will be created for this objectfield - Name of field to createIllegalArgumentException - Bad argumentIllegalAccessException - Unable to access objectInstantiationException - Unable to instantiateprivate static boolean hasDefaultConstructor(Class<?> a_class)
a_class - Class to checkpublic static XMLGregorianCalendar timestamp(String tstamp) throws DatatypeConfigurationException
tstamp - - Must be in format (ISO 8601 subset):
XML Schema 1.0 Part 2, Section 3.2.[7-14].1, Lexical Representation
DatatypeConfigurationException - problem with specified timestamp stringpublic static XMLGregorianCalendar timestamp(int year, int month, int day, int hour, int minute, int second, int millisecond, int timezone) throws DatatypeConfigurationException
year - Yearmonth - Monthday - Day (numeric)hour - Hour of day (24 hour clock)minute - Minutes past hoursecond - Seconds past minutemillisecond - Milliseconds past secondtimezone - Offset in minutes from UTCDatatypeConfigurationException - Problem with data input valuespublic static XMLGregorianCalendar timestamp(BigInteger year, int month, int day, int hour, int minute, int second, BigDecimal fractionalSecond, int timezone) throws DatatypeConfigurationException
year - Yearmonth - Month (1-12)day - Day of month numberhour - Hours into dayminute - Minutes into hoursecond - Seconds into minutefractionalSecond - Fractions of a second past secondtimezone - Timezone offset (numeric)DatatypeConfigurationException - Problem with time specificationpublic Element AddAnyElement(List<Element> ellist, String name, String value) throws JAXBException, ParserConfigurationException
ellist - List to which we will addname - Name of element to addvalue - Value of element to addParserConfigurationException - Unable to parseJAXBException - Problem creating elementpublic static BigInteger toXsInteger(long n)
n - Integer to convertpublic static BigDecimal toXsDecimal(double d)
d - double value to convertpublic static Double toXsDouble(double d)
d - double value to convertCopyright © 2024 Tethys. All rights reserved.