org.jibx.schema.support
Class Conversions

java.lang.Object
  extended by org.jibx.schema.support.Conversions

public final class Conversions
extends Object

Utilities for conversion of schema standard datatypes.

Author:
Dennis M. Sosnoski

Field Summary
static int NAMEFOLLOW_CHARACTER_TYPES
          Character types allowed as non-initial characters of a name.
static int NAMEINIT_CHARACTER_TYPES
          Character types allowed as initial characters of a name.
 
Method Summary
static String checkCollapse(String text)
          Check collapsed whitespace value.
static String checkName(String text, String tname, ValidationContext vctx, Object obj)
          Validate Name value.
static String checkNCName(String text, String tname, ValidationContext vctx, Object obj)
          Check NCName value.
static String checkNMTOKEN(String text, String tname, ValidationContext vctx, Object obj)
          Check NMTOKEN value.
static String checkNormalizedString(String text, String tname, ValidationContext vctx, Object obj)
          Validate normalized string value.
static String checkToken(String text, String tname, ValidationContext vctx, Object obj)
          Validate token value.
static String convertAnyUri(String text, ValidationContext vctx)
          Validate and convert anyURI value.
static int convertEnumeration(String text, EnumSet eset, String name, IUnmarshallingContext ictx)
          Validate and convert enumeration attribute value.
static String convertName(String text, int index, String tname, ValidationContext vctx, Object obj)
          Convert Name value with validation.
static String deserializeName(String text, ValidationContext vctx, Object obj)
          Deserialize Name value.
static String deserializeNCName(String text, ValidationContext vctx, Object obj)
          Deserialize NCName value.
static String deserializeNMTOKEN(String text, ValidationContext vctx, Object obj)
          Deserialize NMTOKEN value.
static String deserializeNormalizedString(String text, ValidationContext vctx, Object obj)
          Deserialize normalized string value.
static String deserializeToken(String text, ValidationContext vctx, Object obj)
          Deserialize token value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMEINIT_CHARACTER_TYPES

public static final int NAMEINIT_CHARACTER_TYPES
Character types allowed as initial characters of a name.

See Also:
Constant Field Values

NAMEFOLLOW_CHARACTER_TYPES

public static final int NAMEFOLLOW_CHARACTER_TYPES
Character types allowed as non-initial characters of a name.

See Also:
Constant Field Values
Method Detail

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 converted
tname - type name
vctx - validation context
obj - object being validated
Returns:
normalized string value (null if nonrecoverable error)

deserializeNormalizedString

public static String deserializeNormalizedString(String text,
                                                 ValidationContext vctx,
                                                 Object obj)
Deserialize normalized string value. This validates the text and, if necessary, converts it to standard form.

Parameters:
text - value to be converted (may be null)
vctx - validation context
obj - object being validated
Returns:
normalized string value (null if input null, or nonrecoverable error)

checkToken

public static String checkToken(String text,
                                String tname,
                                ValidationContext vctx,
                                Object obj)
Validate token value. This validates the text and, if necessary, converts it to standard form.

Parameters:
text - value to be converted (may be null)
tname - type name
vctx - validation context
obj - object being validated
Returns:
token value (null if nonrecoverable error)

deserializeToken

public static String deserializeToken(String text,
                                      ValidationContext vctx,
                                      Object obj)
Deserialize token value. This validates the text and, if necessary, converts it to standard form.

Parameters:
text - value to be converted (may be null)
vctx - validation context
obj - object being validated
Returns:
token value (null if input null, or nonrecoverable error)

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 converted
index - first character offset to be dropped from result
tname - type name
vctx - validation context
obj - object being validated
Returns:
Name value (null if nonrecoverable error)

checkName

public static String checkName(String text,
                               String tname,
                               ValidationContext vctx,
                               Object obj)
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 be null)
tname - type name
vctx - validation context
obj - object being validated
Returns:
Name value (null if nonrecoverable error)

deserializeName

public static String deserializeName(String text,
                                     ValidationContext vctx,
                                     Object obj)
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 be null)
vctx - validation context
obj - object being validated
Returns:
Name value (null if input null, or nonrecoverable error)

checkNCName

public static String checkNCName(String text,
                                 String tname,
                                 ValidationContext vctx,
                                 Object obj)
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 be null)
tname - type name
vctx - validation context
obj - object being validated
Returns:
NCName value (null if nonrecoverable error)

deserializeNCName

public static String deserializeNCName(String text,
                                       ValidationContext vctx,
                                       Object obj)
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 be null)
vctx - validation context
obj - object being validated
Returns:
NCName value (null if input null, or nonrecoverable error)

checkNMTOKEN

public static String checkNMTOKEN(String text,
                                  String tname,
                                  ValidationContext vctx,
                                  Object obj)
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 be null)
tname - type name
vctx - validation context
obj - object being validated
Returns:
NMTOKEN value (null if nonrecoverable error)

deserializeNMTOKEN

public static String deserializeNMTOKEN(String text,
                                        ValidationContext vctx,
                                        Object obj)
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 be null)
vctx - validation context
obj - object being validated
Returns:
NMTOKEN value (null if input null, or nonrecoverable error)

checkCollapse

public static String checkCollapse(String text)
Check collapsed whitespace value. This checks the text and, if necessary, converts it to standard form.

Parameters:
text - value to be converted (may be null)
Returns:
collapsed value

convertAnyUri

public static String convertAnyUri(String text,
                                   ValidationContext vctx)
Validate and convert anyURI value.

Parameters:
text - value to be converted (may be null)
vctx - validation context
Returns:
normalized string value (null if input null, 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 be null)
eset - enumeration set
name - attribute name
ictx - unmarshalling context
Returns:
converted value


Copyright © 2005-2012 jibx.org. All Rights Reserved.