public class XMLDatatypeUtil extends Object
Constructor and Description |
---|
XMLDatatypeUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
collapseWhiteSpace(String s)
Replaces all contiguous sequences of #x9 (tab), #xA (line feed) and #xD
(carriage return) with a single #x20 (space) character, and removes any
leading and trailing whitespace characters, as specified for whiteSpace
facet collapse.
|
static int |
compare(String value1,
String value2,
URI datatype) |
static int |
compareBytes(String int1,
String int2) |
static int |
compareCanonicalDecimals(String dec1,
String dec2)
Compares two canonical decimals to eachother.
|
static int |
compareCanonicalDoubles(String double1,
String double2)
Compares two canonical doubles to eachother.
|
static int |
compareCanonicalFloats(String float1,
String float2)
Compares two canonical floats to eachother.
|
static int |
compareCanonicalFPNumbers(String float1,
String float2)
Compares two canonical floating point numbers to eachother.
|
static int |
compareCanonicalIntegers(String int1,
String int2)
Compares two canonical integers to eachother.
|
static int |
compareDateTime(String value1,
String value2)
Compares two dateTime objects.
|
static int |
compareDecimals(String dec1,
String dec2)
Compares two decimals to eachother.
|
static int |
compareDoubles(String double1,
String double2)
Compares two doubles to eachother.
|
static int |
compareFloats(String float1,
String float2)
Compares two floats to eachother.
|
static int |
compareFPNumbers(String fp1,
String fp2)
Compares two floating point numbers to eachother.
|
static int |
compareIntegers(String int1,
String int2)
Compares two integers to eachother.
|
static int |
compareInts(String int1,
String int2) |
static int |
compareLongs(String int1,
String int2) |
static int |
compareNegativeIntegers(String int1,
String int2) |
static int |
compareNonNegativeIntegers(String int1,
String int2) |
static int |
compareNonPositiveIntegers(String int1,
String int2) |
static int |
comparePositiveIntegers(String int1,
String int2) |
static int |
compareShorts(String int1,
String int2) |
static int |
compareUnsignedBytes(String int1,
String int2) |
static int |
compareUnsignedInts(String int1,
String int2) |
static int |
compareUnsignedLongs(String int1,
String int2) |
static int |
compareUnsignedShorts(String int1,
String int2) |
static boolean |
isBuiltInDatatype(URI datatype)
Checks whether the supplied datatype is a built-in XML Schema datatype.
|
static boolean |
isCalendarDatatype(URI datatype)
Checks whether the supplied datatype is equal to xsd:dateTime, xsd:date,
xsd:time, xsd:gYearMonth, xsd:gMonthDay, xsd:gYear, xsd:gMonth or
xsd:gDay.
|
static boolean |
isDecimalDatatype(URI datatype)
Checks whether the supplied datatype is equal to xsd:decimal or one of the
built-in datatypes that is derived from xsd:decimal.
|
static boolean |
isDerivedDatatype(URI datatype)
Checks whether the supplied datatype is a derived XML Schema datatype.
|
static boolean |
isFloatingPointDatatype(URI datatype)
Checks whether the supplied datatype is equal to xsd:float or xsd:double.
|
static boolean |
isIntegerDatatype(URI datatype)
Checks whether the supplied datatype is equal to xsd:integer or one of the
built-in datatypes that is derived from xsd:integer.
|
static boolean |
isNumericDatatype(URI datatype)
Checks whether the supplied datatype is a numeric datatype, i.e.
|
static boolean |
isOrderedDatatype(URI datatype)
Checks whether the supplied datatype is ordered.
|
static boolean |
isPrimitiveDatatype(URI datatype)
Checks whether the supplied datatype is a primitive XML Schema datatype.
|
static boolean |
isValidBoolean(String value) |
static boolean |
isValidByte(String value) |
static boolean |
isValidDate(String value)
Determines if the supplied value is a valid xsd:date string.
|
static boolean |
isValidDateTime(String value) |
static boolean |
isValidDayTimeDuration(String value) |
static boolean |
isValidDecimal(String value) |
static boolean |
isValidDouble(String value) |
static boolean |
isValidDuration(String value) |
static boolean |
isValidFloat(String value) |
static boolean |
isValidGDay(String value)
Determines if the supplied value is a valid xsd:gDay string.
|
static boolean |
isValidGMonth(String value)
Determines if the supplied value is a valid xsd:gMonth string.
|
static boolean |
isValidGMonthDay(String value)
Determines if the supplied value is a valid xsd:gMonthDay string.
|
static boolean |
isValidGYear(String value)
Determines if the supplied value is a valid xsd:gYear string.
|
static boolean |
isValidGYearMonth(String value)
Determines if the supplied value is a valid xsd:gYearMonth string.
|
static boolean |
isValidInt(String value) |
static boolean |
isValidInteger(String value) |
static boolean |
isValidLong(String value) |
static boolean |
isValidNegativeInteger(String value) |
static boolean |
isValidNonNegativeInteger(String value) |
static boolean |
isValidNonPositiveInteger(String value) |
static boolean |
isValidPositiveInteger(String value) |
static boolean |
isValidQName(String value)
Determines if the supplied value is a valid xsd:QName string.
|
static boolean |
isValidShort(String value) |
static boolean |
isValidTime(String value)
Determines if the supplied value is a valid xsd:time string.
|
static boolean |
isValidUnsignedByte(String value) |
static boolean |
isValidUnsignedInt(String value) |
static boolean |
isValidUnsignedLong(String value) |
static boolean |
isValidUnsignedShort(String value) |
static boolean |
isValidValue(String value,
URI datatype)
Verifies if the supplied lexical value is valid for the given datatype.
|
static String |
normalize(String value,
URI datatype)
Normalizes the supplied value according to the normalization rules for the
supplied datatype.
|
static String |
normalizeBoolean(String value)
Normalizes a boolean value to its canonical representation.
|
static String |
normalizeByte(String value)
Normalizes an xsd:byte.
|
static String |
normalizeDateTime(String value)
Normalizes an xsd:dateTime.
|
static String |
normalizeDecimal(String decimal)
Normalizes a decimal to its canonical representation.
|
static String |
normalizeDouble(String value)
Normalizes a double to its canonical representation.
|
static String |
normalizeFloat(String value)
Normalizes a float to its canonical representation.
|
static String |
normalizeFPNumber(String value)
Normalizes a floating point number to its canonical representation.
|
static String |
normalizeInt(String value)
Normalizes an xsd:int.
|
static String |
normalizeInteger(String value)
Normalizes an integer to its canonical representation.
|
static String |
normalizeLong(String value)
Normalizes an xsd:long.
|
static String |
normalizeNegativeInteger(String value)
Normalizes an xsd:negativeInteger.
|
static String |
normalizeNonNegativeInteger(String value)
Normalizes an xsd:nonNegativeInteger.
|
static String |
normalizeNonPositiveInteger(String value)
Normalizes an xsd:nonPositiveInteger.
|
static String |
normalizePositiveInteger(String value)
Normalizes an xsd:positiveInteger.
|
static String |
normalizeShort(String value)
Normalizes an xsd:short.
|
static String |
normalizeUnsignedByte(String value)
Normalizes an xsd:unsignedByte.
|
static String |
normalizeUnsignedInt(String value)
Normalizes an xsd:unsignedInt.
|
static String |
normalizeUnsignedLong(String value)
Normalizes an xsd:unsignedLong.
|
static String |
normalizeUnsignedShort(String value)
Normalizes an xsd:unsignedShort.
|
static boolean |
parseBoolean(String s)
Parses the supplied xsd:boolean string and returns its value.
|
static byte |
parseByte(String s)
Parses the supplied xsd:byte string and returns its value.
|
static XMLGregorianCalendar |
parseCalendar(String s)
Parses the supplied calendar value string and returns its value.
|
static BigDecimal |
parseDecimal(String s)
Parses the supplied decimal/floating point string and returns its value.
|
static double |
parseDouble(String s)
Parses the supplied xsd:double string and returns its value.
|
static float |
parseFloat(String s)
Parses the supplied xsd:float string and returns its value.
|
static int |
parseInt(String s)
Parses the supplied xsd:int strings and returns its value.
|
static BigInteger |
parseInteger(String s)
Parses the supplied xsd:integer string and returns its value.
|
static long |
parseLong(String s)
Parses the supplied xsd:long string and returns its value.
|
static short |
parseShort(String s)
Parses the supplied xsd:short string and returns its value.
|
static URI |
qnameToURI(QName qname)
Maps a datatype QName from the javax.xml.namespace package to an XML
Schema URI for the corresponding datatype.
|
public static boolean isPrimitiveDatatype(URI datatype)
public static boolean isDerivedDatatype(URI datatype)
public static boolean isBuiltInDatatype(URI datatype)
public static boolean isNumericDatatype(URI datatype)
public static boolean isDecimalDatatype(URI datatype)
public static boolean isIntegerDatatype(URI datatype)
public static boolean isFloatingPointDatatype(URI datatype)
public static boolean isCalendarDatatype(URI datatype)
XMLGregorianCalendar
public static boolean isOrderedDatatype(URI datatype)
public static boolean isValidValue(String value, URI datatype)
value
- a lexical valuedatatype
- an XML Schema datatatype.public static boolean isValidDecimal(String value)
public static boolean isValidInteger(String value)
public static boolean isValidNegativeInteger(String value)
public static boolean isValidNonPositiveInteger(String value)
public static boolean isValidNonNegativeInteger(String value)
public static boolean isValidPositiveInteger(String value)
public static boolean isValidLong(String value)
public static boolean isValidInt(String value)
public static boolean isValidShort(String value)
public static boolean isValidByte(String value)
public static boolean isValidUnsignedLong(String value)
public static boolean isValidUnsignedInt(String value)
public static boolean isValidUnsignedShort(String value)
public static boolean isValidUnsignedByte(String value)
public static boolean isValidFloat(String value)
public static boolean isValidDouble(String value)
public static boolean isValidBoolean(String value)
public static boolean isValidDuration(String value)
public static boolean isValidDayTimeDuration(String value)
public static boolean isValidDateTime(String value)
public static boolean isValidDate(String value)
value
- public static boolean isValidTime(String value)
value
- public static boolean isValidGDay(String value)
value
- public static boolean isValidGMonth(String value)
value
- public static boolean isValidGMonthDay(String value)
value
- public static boolean isValidGYear(String value)
value
- public static boolean isValidGYearMonth(String value)
value
- public static boolean isValidQName(String value)
value
- public static String normalize(String value, URI datatype)
value
- The value to normalize.datatype
- The value's datatype.IllegalArgumentException
- If the supplied value is illegal considering the supplied
datatype.public static String normalizeBoolean(String value)
value
- The boolean value to normalize.IllegalArgumentException
- If the supplied value is not a legal boolean.public static String normalizeDecimal(String decimal)
decimal
- The decimal to normalize.IllegalArgumentException
- If one of the supplied strings is not a legal decimal.public static String normalizeInteger(String value)
value
- The value to normalize.IllegalArgumentException
- If the supplied value is not a legal integer.public static String normalizeNegativeInteger(String value)
public static String normalizeNonPositiveInteger(String value)
public static String normalizeNonNegativeInteger(String value)
public static String normalizePositiveInteger(String value)
public static String normalizeUnsignedLong(String value)
public static String normalizeUnsignedInt(String value)
public static String normalizeUnsignedShort(String value)
public static String normalizeUnsignedByte(String value)
public static String normalizeFloat(String value)
value
- The value to normalize.IllegalArgumentException
- If the supplied value is not a legal float.public static String normalizeDouble(String value)
value
- The value to normalize.IllegalArgumentException
- If the supplied value is not a legal double.public static String normalizeFPNumber(String value)
value
- The value to normalize.IllegalArgumentException
- If the supplied value is not a legal floating point number.public static String normalizeDateTime(String value)
value
- The value to normalize.IllegalArgumentException
- If the supplied value is not a legal xsd:dateTime value.public static String collapseWhiteSpace(String s)
public static int compareDecimals(String dec1, String dec2)
IllegalArgumentException
- If one of the supplied strings is not a legal decimal.public static int compareCanonicalDecimals(String dec1, String dec2)
IllegalArgumentException
- If one of the supplied strings is not a legal decimal.public static int compareIntegers(String int1, String int2)
IllegalArgumentException
- If one of the supplied strings is not a legal integer.public static int compareCanonicalIntegers(String int1, String int2)
IllegalArgumentException
- If one of the supplied strings is not a legal integer.public static int compareFloats(String float1, String float2)
IllegalArgumentException
- If one of the supplied strings is not a legal float or if
NaN is compared to a float other than NaN.public static int compareCanonicalFloats(String float1, String float2)
IllegalArgumentException
- If one of the supplied strings is not a legal float or if
NaN is compared to a float other than NaN.public static int compareDoubles(String double1, String double2)
IllegalArgumentException
- If one of the supplied strings is not a legal double or if
NaN is compared to a double other than NaN.public static int compareCanonicalDoubles(String double1, String double2)
IllegalArgumentException
- If one of the supplied strings is not a legal double or if
NaN is compared to a double other than NaN.public static int compareFPNumbers(String fp1, String fp2)
IllegalArgumentException
- If one of the supplied strings is not a legal floating point
number or if NaN is compared to a floating point number
other than NaN.public static int compareCanonicalFPNumbers(String float1, String float2)
IllegalArgumentException
- If one of the supplied strings is not a legal floating point
number or if NaN is compared to a floating point number
other than NaN.public static int compareDateTime(String value1, String value2)
value1
- An xsd:dateTime value.value2
- An xsd:dateTime value.public static boolean parseBoolean(String s)
s
- A string representation of an xsd:boolean value.NumberFormatException
- If the supplied string is not a valid xsd:boolean value.public static byte parseByte(String s)
s
- A string representation of an xsd:byte value.NumberFormatException
- If the supplied string is not a valid xsd:byte value.public static short parseShort(String s)
s
- A string representation of an xsd:short value.NumberFormatException
- If the supplied string is not a valid xsd:short value.public static int parseInt(String s)
s
- A string representation of an xsd:int value.NumberFormatException
- If the supplied string is not a valid xsd:int value.public static long parseLong(String s)
s
- A string representation of an xsd:long value.NumberFormatException
- If the supplied string is not a valid xsd:long value.public static float parseFloat(String s)
s
- A string representation of an xsd:float value.NumberFormatException
- If the supplied string is not a valid xsd:float value.public static double parseDouble(String s)
s
- A string representation of an xsd:double value.NumberFormatException
- If the supplied string is not a valid xsd:double value.public static BigInteger parseInteger(String s)
s
- A string representation of an xsd:integer value.NumberFormatException
- If the supplied string is not a valid xsd:integer value.public static BigDecimal parseDecimal(String s)
s
- A string representation of an xsd:decimal or xsd:double value.NumberFormatException
- If the supplied string is not a valid xsd:decimal or xsd:double
value.public static XMLGregorianCalendar parseCalendar(String s)
s
- A string representation of an xsd:dateTime, xsd:time, xsd:date,
xsd:gYearMonth, xsd:gMonthDay, xsd:gYear, xsd:gMonth or xsd:gDay
value.NumberFormatException
- If the supplied string is not a valid calendar value.public static URI qnameToURI(QName qname)
DatatypeConstants
.qname
- One of the XML Schema qnames from DatatypeConstants
.IllegalArgumentException
- If the supplied qname was not recognized by this method.DatatypeConstants
Copyright © 2001-2016 Aduna. All Rights Reserved.