Package org.jibx.schema.support
Class Conversions
java.lang.Object
org.jibx.schema.support.Conversions
Utilities for conversion of schema standard datatypes.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCharacter types allowed as non-initial characters of a name.static final intCharacter types allowed as initial characters of a name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckCollapse(String text) Check collapsed whitespace value.static StringcheckName(String text, String tname, ValidationContext vctx, Object obj) Validate Name value.static StringcheckNCName(String text, String tname, ValidationContext vctx, Object obj) Check NCName value.static StringcheckNMTOKEN(String text, String tname, ValidationContext vctx, Object obj) Check NMTOKEN value.static StringcheckNormalizedString(String text, String tname, ValidationContext vctx, Object obj) Validate normalized string value.static StringcheckToken(String text, String tname, ValidationContext vctx, Object obj) Validate token value.static StringconvertAnyUri(String text, ValidationContext vctx) Validate and convert anyURI value.private static StringconvertCollapsed(String text, int index) Convert collapsed string value.static intconvertEnumeration(String text, EnumSet eset, String name, IUnmarshallingContext ictx) Validate and convert enumeration attribute value.static StringconvertName(String text, int index, String tname, ValidationContext vctx, Object obj) Convert Name value with validation.private static StringconvertNCName(String text, int index, String tname, ValidationContext vctx, Object obj) Convert NCName value with validation.private static StringconvertNMTOKEN(String text, int index, String tname, ValidationContext vctx, Object obj) Convert NMTOKEN value with validation.private static StringconvertNormalizedString(String text, int index, String tname, ValidationContext vctx, Object obj) Convert normalized string value with validation.private static StringconvertToken(String text, int index, String tname, ValidationContext vctx, Object obj) Convert token-type value with validation.static StringdeserializeName(String text, ValidationContext vctx, Object obj) Deserialize Name value.static StringdeserializeNCName(String text, ValidationContext vctx, Object obj) Deserialize NCName value.static StringdeserializeNMTOKEN(String text, ValidationContext vctx, Object obj) Deserialize NMTOKEN value.static StringdeserializeNormalizedString(String text, ValidationContext vctx, Object obj) Deserialize normalized string value.static StringdeserializeToken(String text, ValidationContext vctx, Object obj) Deserialize token value.
-
Field Details
-
NAMEINIT_CHARACTER_TYPES
public static final int NAMEINIT_CHARACTER_TYPESCharacter types allowed as initial characters of a name.- See Also:
-
NAMEFOLLOW_CHARACTER_TYPES
public static final int NAMEFOLLOW_CHARACTER_TYPESCharacter types allowed as non-initial characters of a name.- See Also:
-
-
Constructor Details
-
Conversions
private Conversions()Non-constructor for class with no instances.
-
-
Method Details
-
convertNormalizedString
private static String convertNormalizedString(String text, int index, String tname, ValidationContext vctx, Object obj) Convert normalized string value with validation. This handles the actual conversion of a normalized string value. The first character to be dropped must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from resulttname- type namevctx- validation contextobj- object being validated- Returns:
- normalized string value (
nullif nonrecoverable error)
-
checkNormalizedString
public static String checkNormalizedString(String text, String tname, ValidationContext vctx, Object obj) Validate normalized string value. This checks the text and, if necessary, converts it to valid form.- Parameters:
text- value to be convertedtname- type namevctx- validation contextobj- object being validated- Returns:
- normalized string value (
nullif nonrecoverable error)
-
deserializeNormalizedString
Deserialize normalized string value. This validates the text and, if necessary, converts it to standard form.- Parameters:
text- value to be converted (may benull)vctx- validation contextobj- object being validated- Returns:
- normalized string value (
nullif inputnull, or nonrecoverable error)
-
convertToken
private static String convertToken(String text, int index, String tname, ValidationContext vctx, Object obj) Convert token-type value with validation. This handles the actual conversion of a value with no leading or trailing spaces, no non-space whitespaces, . The first character to be dropped must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from resulttname- type namevctx- validation contextobj- object being validated- Returns:
- token value (
nullif nonrecoverable error)
-
checkToken
Validate token value. This validates the text and, if necessary, converts it to standard form.- Parameters:
text- value to be converted (may benull)tname- type namevctx- validation contextobj- object being validated- Returns:
- token value (
nullif nonrecoverable error)
-
deserializeToken
Deserialize token value. This validates the text and, if necessary, converts it to standard form.- Parameters:
text- value to be converted (may benull)vctx- validation contextobj- object being validated- Returns:
- token value (
nullif inputnull, or nonrecoverable error)
-
convertCollapsed
Convert collapsed string value. The first character to be collapsed must must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from result- Returns:
- normalized string value
-
convertName
public static String convertName(String text, int index, String tname, ValidationContext vctx, Object obj) Convert Name value with validation. This handles the actual conversion of a Name value by dropping illegal characters. It should only be called when error recovery is enabled. The first character to be dropped must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from resulttname- type namevctx- validation contextobj- object being validated- Returns:
- Name value (
nullif nonrecoverable error)
-
checkName
Validate Name value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)tname- type namevctx- validation contextobj- object being validated- Returns:
- Name value (
nullif nonrecoverable error)
-
deserializeName
Deserialize Name value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)vctx- validation contextobj- object being validated- Returns:
- Name value (
nullif inputnull, or nonrecoverable error)
-
convertNCName
private static String convertNCName(String text, int index, String tname, ValidationContext vctx, Object obj) Convert NCName value with validation. This handles the actual conversion of an NCName value by dropping illegal characters. It should only be called when error recovery is enabled. The first character to be dropped must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from resulttname- type namevctx- validation contextobj- object being validated- Returns:
- NCName value
-
checkNCName
Check NCName value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)tname- type namevctx- validation contextobj- object being validated- Returns:
- NCName value (
nullif nonrecoverable error)
-
deserializeNCName
Deserialize NCName value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)vctx- validation contextobj- object being validated- Returns:
- NCName value (
nullif inputnull, or nonrecoverable error)
-
convertNMTOKEN
private static String convertNMTOKEN(String text, int index, String tname, ValidationContext vctx, Object obj) Convert NMTOKEN value with validation. This handles the actual conversion of an NMTOKEN value by dropping illegal characters. It should only be called when error recovery is enabled. The first character to be dropped must have been found prior to this call.- Parameters:
text- value to be convertedindex- first character offset to be dropped from resulttname- type namevctx- validation contextobj- object being validated- Returns:
- NMTOKEN value
-
checkNMTOKEN
Check NMTOKEN value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)tname- type namevctx- validation contextobj- object being validated- Returns:
- NMTOKEN value (
nullif nonrecoverable error)
-
deserializeNMTOKEN
Deserialize NMTOKEN value. This validates the text and, if necessary, converts it to valid form by dropping illegal characters (only if error recovery is enabled).- Parameters:
text- value to be converted (may benull)vctx- validation contextobj- object being validated- Returns:
- NMTOKEN value (
nullif inputnull, or nonrecoverable error)
-
checkCollapse
Check collapsed whitespace value. This checks the text and, if necessary, converts it to standard form.- Parameters:
text- value to be converted (may benull)- Returns:
- collapsed value
-
convertAnyUri
Validate and convert anyURI value.- Parameters:
text- value to be converted (may benull)vctx- validation context- Returns:
- normalized string value (
nullif inputnull, or error)
-
convertEnumeration
public static int convertEnumeration(String text, EnumSet eset, String name, IUnmarshallingContext ictx) Validate and convert enumeration attribute value.- Parameters:
text- value to be converted (may benull)eset- enumeration setname- attribute nameictx- unmarshalling context- Returns:
- converted value
-