org.apache.axis2.databinding.utils
Class ConverterUtil

java.lang.Object
  extended by org.apache.axis2.databinding.utils.ConverterUtil

public class ConverterUtil
extends java.lang.Object

Converter methods to go from 1. simple type -> String 2. simple type -> Object 3. String -> simpletype 4. Object list -> array


Nested Class Summary
static class ConverterUtil.ObjectConversionException
          A simple exception that is thrown when the conversion fails
 
Field Summary
static java.lang.String SYSTEM_PROPERTY_ADB_CONVERTERUTIL
           
 
Constructor Summary
ConverterUtil()
           
 
Method Summary
static void appendDate(java.lang.StringBuffer dateString, java.util.Calendar calendar)
           
static void appendTime(java.util.Calendar value, java.lang.StringBuffer dateString)
           
static void appendTimeZone(java.util.Calendar calendar, java.lang.StringBuffer dateString)
           
static double compare(java.math.BigDecimal binBigDecimal, java.lang.String value)
           
static int compare(java.math.BigInteger binBigInteger, java.lang.String value)
           
static int compare(byte byteVlaue, java.lang.String value)
           
static long compare(java.util.Calendar calendar, java.lang.String value)
           
static long compare(java.util.Date date, java.lang.String value)
           
static double compare(double doubleValue, java.lang.String value)
           
static long compare(Duration duration, java.lang.String value)
           
static float compare(float floatValue, java.lang.String value)
           
static int compare(int intValue, java.lang.String value)
           
static long compare(long longValue, java.lang.String value)
           
static int compare(short shortValue, java.lang.String value)
           
static long compare(Time time, java.lang.String value)
           
static java.lang.String convertToAnySimpleType(java.lang.String s)
           
static org.apache.axiom.om.OMElement convertToAnyType(java.lang.String s)
           
static URI convertToAnyURI(java.lang.String s)
           
static java.lang.Object convertToArray(java.lang.Class baseArrayClass, java.util.List objectList)
           
static java.lang.Object convertToArray(java.lang.Class baseArrayClass, java.lang.String[] valueArray)
           
static javax.activation.DataHandler convertToBase64Binary(java.lang.String s)
           
static java.math.BigDecimal convertToBigDecimal(java.lang.String s)
           
static java.math.BigInteger convertToBigInteger(java.lang.String s)
           
static boolean convertToBoolean(java.lang.String s)
           
static byte convertToByte(java.lang.String s)
           
static javax.activation.DataHandler convertToDataHandler(java.lang.String s)
           
static java.util.Date convertToDate(java.lang.String source)
          Converts a given string into a date.
static java.util.Calendar convertToDateTime(java.lang.String source)
          Code from Axis1 code base Note - We only follow the convention in the latest schema spec
static java.math.BigDecimal convertToDecimal(java.lang.String s)
           
static double convertToDouble(java.lang.String s)
           
static Duration convertToDuration(java.lang.String s)
           
static Entities convertToENTITIES(java.lang.String s)
           
static Entity convertToENTITY(java.lang.String s)
           
static float convertToFloat(java.lang.String s)
           
static Day convertToGDay(java.lang.String s)
           
static Month convertToGMonth(java.lang.String s)
           
static MonthDay convertToGMonthDay(java.lang.String s)
           
static Year convertToGYear(java.lang.String s)
           
static YearMonth convertToGYearMonth(java.lang.String s)
           
static HexBinary convertToHexBinary(java.lang.String s)
           
static Id convertToId(java.lang.String s)
           
static Id convertToID(java.lang.String s)
           
static IDRef convertToIDREF(java.lang.String s)
           
static IDRefs convertToIDREFS(java.lang.String s)
           
static int convertToInt(java.lang.String s)
           
static java.math.BigInteger convertToInteger(java.lang.String s)
           
static Language convertToLanguage(java.lang.String s)
           
static long convertToLong(java.lang.String s)
           
static Name convertToName(java.lang.String s)
           
static NCName convertToNCName(java.lang.String s)
           
static NegativeInteger convertToNegativeInteger(java.lang.String s)
           
static NMToken convertToNMTOKEN(java.lang.String s)
           
static NMTokens convertToNMTOKENS(java.lang.String s)
           
static NonNegativeInteger convertToNonNegativeInteger(java.lang.String s)
           
static NonPositiveInteger convertToNonPositiveInteger(java.lang.String s)
           
static NormalizedString convertToNormalizedString(java.lang.String s)
           
static Notation convertToNOTATION(java.lang.String s)
           
static java.lang.Object convertToObject(boolean i)
           
static java.lang.Object convertToObject(byte i)
           
static java.lang.Object convertToObject(char i)
           
static java.lang.Object convertToObject(double i)
           
static java.lang.Object convertToObject(short i)
           
static java.lang.Object convertToObject(java.lang.String i)
           
static PositiveInteger convertToPositiveInteger(java.lang.String s)
           
static QName convertToQName(java.lang.String source, java.lang.String nameSpaceuri)
          Code from Axis1 code base
static short convertToShort(java.lang.String s)
           
static java.lang.String convertToString(java.math.BigInteger o)
           
static java.lang.String convertToString(boolean i)
           
static java.lang.String convertToString(byte i)
           
static java.lang.String convertToString(java.lang.Byte o)
           
static java.lang.String convertToString(byte[] bytes)
           
static java.lang.String convertToString(java.util.Calendar value)
           
static java.lang.String convertToString(char i)
           
static java.lang.String convertToString(javax.activation.DataHandler handler)
           
static java.lang.String convertToString(java.util.Date value)
           
static java.lang.String convertToString(Day o)
           
static java.lang.String convertToString(double i)
           
static java.lang.String convertToString(java.lang.Double o)
           
static java.lang.String convertToString(Duration o)
           
static java.lang.String convertToString(float i)
           
static java.lang.String convertToString(java.lang.Float o)
           
static java.lang.String convertToString(HexBinary o)
           
static java.lang.String convertToString(int i)
           
static java.lang.String convertToString(java.lang.Integer o)
           
static java.lang.String convertToString(long i)
           
static java.lang.String convertToString(java.lang.Long o)
           
static java.lang.String convertToString(Month o)
           
static java.lang.String convertToString(MonthDay o)
           
static java.lang.String convertToString(java.lang.Object o)
           
static java.lang.String convertToString(QName o)
           
static java.lang.String convertToString(short i)
           
static java.lang.String convertToString(java.lang.Short o)
           
static java.lang.String convertToString(java.lang.String s)
           
static java.lang.String convertToString(Time o)
           
static java.lang.String convertToString(UnsignedByte o)
           
static java.lang.String convertToString(UnsignedInt o)
           
static java.lang.String convertToString(UnsignedLong o)
           
static java.lang.String convertToString(Year o)
           
static java.lang.String convertToString(YearMonth o)
           
static Time convertToTime(java.lang.String s)
           
static Token convertToToken(java.lang.String s)
           
static UnsignedByte convertToUnsignedByte(java.lang.String s)
           
static UnsignedInt convertToUnsignedInt(java.lang.String s)
           
static UnsignedLong convertToUnsignedLong(java.lang.String s)
           
static UnsignedShort convertToUnsignedShort(java.lang.String s)
           
static URI convertToURI(java.lang.String s)
           
static java.lang.Object getAnyTypeObject(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.Class extensionMapperClass)
           
static java.lang.Object getObjectForClass(java.lang.Class clazz, java.lang.String value)
          A reflection based method to generate an instance of a given class and populate it with a given value
static java.lang.String getStringFromDatahandler(javax.activation.DataHandler dataHandler)
          Converts the given .datahandler to a string
static void serializeAnyType(java.lang.Object value, javax.xml.stream.XMLStreamWriter xmlStreamWriter)
           
static java.util.List toList(java.lang.Object[] array)
          We could have used the Arraya.asList() method but that returns an *immutable* list !!!!!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_PROPERTY_ADB_CONVERTERUTIL

public static final java.lang.String SYSTEM_PROPERTY_ADB_CONVERTERUTIL
See Also:
Constant Field Values
Constructor Detail

ConverterUtil

public ConverterUtil()
Method Detail

convertToString

public static java.lang.String convertToString(int i)

convertToString

public static java.lang.String convertToString(float i)

convertToString

public static java.lang.String convertToString(long i)

convertToString

public static java.lang.String convertToString(double i)

convertToString

public static java.lang.String convertToString(byte i)

convertToString

public static java.lang.String convertToString(char i)

convertToString

public static java.lang.String convertToString(short i)

convertToString

public static java.lang.String convertToString(boolean i)

convertToString

public static java.lang.String convertToString(java.util.Date value)

appendTimeZone

public static void appendTimeZone(java.util.Calendar calendar,
                                  java.lang.StringBuffer dateString)

appendDate

public static void appendDate(java.lang.StringBuffer dateString,
                              java.util.Calendar calendar)

convertToString

public static java.lang.String convertToString(java.util.Calendar value)

appendTime

public static void appendTime(java.util.Calendar value,
                              java.lang.StringBuffer dateString)

convertToString

public static java.lang.String convertToString(Day o)

convertToString

public static java.lang.String convertToString(YearMonth o)

convertToString

public static java.lang.String convertToString(Year o)

convertToString

public static java.lang.String convertToString(HexBinary o)

convertToString

public static java.lang.String convertToString(MonthDay o)

convertToString

public static java.lang.String convertToString(Time o)

convertToString

public static java.lang.String convertToString(java.lang.Byte o)

convertToString

public static java.lang.String convertToString(java.math.BigInteger o)

convertToString

public static java.lang.String convertToString(java.lang.Integer o)

convertToString

public static java.lang.String convertToString(java.lang.Long o)

convertToString

public static java.lang.String convertToString(java.lang.Short o)

convertToString

public static java.lang.String convertToString(UnsignedByte o)

convertToString

public static java.lang.String convertToString(UnsignedInt o)

convertToString

public static java.lang.String convertToString(UnsignedLong o)

convertToString

public static java.lang.String convertToString(QName o)

convertToString

public static java.lang.String convertToString(java.lang.Object o)

convertToString

public static java.lang.String convertToString(java.lang.Double o)

convertToString

public static java.lang.String convertToString(Duration o)

convertToString

public static java.lang.String convertToString(java.lang.Float o)

convertToString

public static java.lang.String convertToString(Month o)

convertToString

public static java.lang.String convertToString(byte[] bytes)

convertToString

public static java.lang.String convertToString(javax.activation.DataHandler handler)

convertToInt

public static int convertToInt(java.lang.String s)

convertToBigDecimal

public static java.math.BigDecimal convertToBigDecimal(java.lang.String s)

convertToDouble

public static double convertToDouble(java.lang.String s)

convertToDecimal

public static java.math.BigDecimal convertToDecimal(java.lang.String s)

convertToFloat

public static float convertToFloat(java.lang.String s)

convertToString

public static java.lang.String convertToString(java.lang.String s)

convertToLong

public static long convertToLong(java.lang.String s)

convertToShort

public static short convertToShort(java.lang.String s)

convertToBoolean

public static boolean convertToBoolean(java.lang.String s)

convertToAnySimpleType

public static java.lang.String convertToAnySimpleType(java.lang.String s)

convertToAnyType

public static org.apache.axiom.om.OMElement convertToAnyType(java.lang.String s)

convertToGYearMonth

public static YearMonth convertToGYearMonth(java.lang.String s)

convertToGMonthDay

public static MonthDay convertToGMonthDay(java.lang.String s)

convertToGYear

public static Year convertToGYear(java.lang.String s)

convertToGMonth

public static Month convertToGMonth(java.lang.String s)

convertToGDay

public static Day convertToGDay(java.lang.String s)

convertToDuration

public static Duration convertToDuration(java.lang.String s)

convertToHexBinary

public static HexBinary convertToHexBinary(java.lang.String s)

convertToBase64Binary

public static javax.activation.DataHandler convertToBase64Binary(java.lang.String s)

convertToDataHandler

public static javax.activation.DataHandler convertToDataHandler(java.lang.String s)

convertToDate

public static java.util.Date convertToDate(java.lang.String source)
Converts a given string into a date. Code from Axis1 DateDeserializer.

Parameters:
source -
Returns:
Returns Date.

convertToTime

public static Time convertToTime(java.lang.String s)

convertToToken

public static Token convertToToken(java.lang.String s)

convertToNormalizedString

public static NormalizedString convertToNormalizedString(java.lang.String s)

convertToUnsignedLong

public static UnsignedLong convertToUnsignedLong(java.lang.String s)

convertToUnsignedInt

public static UnsignedInt convertToUnsignedInt(java.lang.String s)

convertToUnsignedShort

public static UnsignedShort convertToUnsignedShort(java.lang.String s)

convertToUnsignedByte

public static UnsignedByte convertToUnsignedByte(java.lang.String s)

convertToNonNegativeInteger

public static NonNegativeInteger convertToNonNegativeInteger(java.lang.String s)

convertToNegativeInteger

public static NegativeInteger convertToNegativeInteger(java.lang.String s)

convertToPositiveInteger

public static PositiveInteger convertToPositiveInteger(java.lang.String s)

convertToNonPositiveInteger

public static NonPositiveInteger convertToNonPositiveInteger(java.lang.String s)

convertToName

public static Name convertToName(java.lang.String s)

convertToNCName

public static NCName convertToNCName(java.lang.String s)

convertToID

public static Id convertToID(java.lang.String s)

convertToId

public static Id convertToId(java.lang.String s)

convertToLanguage

public static Language convertToLanguage(java.lang.String s)

convertToNMTOKEN

public static NMToken convertToNMTOKEN(java.lang.String s)

convertToNMTOKENS

public static NMTokens convertToNMTOKENS(java.lang.String s)

convertToNOTATION

public static Notation convertToNOTATION(java.lang.String s)

convertToENTITY

public static Entity convertToENTITY(java.lang.String s)

convertToENTITIES

public static Entities convertToENTITIES(java.lang.String s)

convertToIDREF

public static IDRef convertToIDREF(java.lang.String s)

convertToIDREFS

public static IDRefs convertToIDREFS(java.lang.String s)

convertToURI

public static URI convertToURI(java.lang.String s)

convertToAnyURI

public static URI convertToAnyURI(java.lang.String s)

convertToInteger

public static java.math.BigInteger convertToInteger(java.lang.String s)

convertToBigInteger

public static java.math.BigInteger convertToBigInteger(java.lang.String s)

convertToByte

public static byte convertToByte(java.lang.String s)

convertToDateTime

public static java.util.Calendar convertToDateTime(java.lang.String source)
Code from Axis1 code base Note - We only follow the convention in the latest schema spec

Parameters:
source -
Returns:
Returns Calendar.

convertToQName

public static QName convertToQName(java.lang.String source,
                                   java.lang.String nameSpaceuri)
Code from Axis1 code base

Parameters:
source -
Returns:
Returns QName.

convertToObject

public static java.lang.Object convertToObject(java.lang.String i)

convertToObject

public static java.lang.Object convertToObject(boolean i)

convertToObject

public static java.lang.Object convertToObject(double i)

convertToObject

public static java.lang.Object convertToObject(byte i)

convertToObject

public static java.lang.Object convertToObject(char i)

convertToObject

public static java.lang.Object convertToObject(short i)

convertToArray

public static java.lang.Object convertToArray(java.lang.Class baseArrayClass,
                                              java.lang.String[] valueArray)

convertToArray

public static java.lang.Object convertToArray(java.lang.Class baseArrayClass,
                                              java.util.List objectList)
Parameters:
baseArrayClass -
objectList - -> for primitive type array conversion we assume the content to be strings!
Returns:
Returns Object.

toList

public static java.util.List toList(java.lang.Object[] array)
We could have used the Arraya.asList() method but that returns an *immutable* list !!!!!

Parameters:
array -
Returns:
list

compare

public static int compare(int intValue,
                          java.lang.String value)
Parameters:
intValue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static double compare(double doubleValue,
                             java.lang.String value)
Parameters:
doubleValue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static float compare(float floatValue,
                            java.lang.String value)
Parameters:
floatValue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static long compare(long longValue,
                           java.lang.String value)
Parameters:
longValue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static int compare(short shortValue,
                          java.lang.String value)
Parameters:
shortValue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static int compare(byte byteVlaue,
                          java.lang.String value)
Parameters:
byteVlaue -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static int compare(java.math.BigInteger binBigInteger,
                          java.lang.String value)
Parameters:
binBigInteger -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static double compare(java.math.BigDecimal binBigDecimal,
                             java.lang.String value)
Parameters:
binBigDecimal -
value -
Returns:
0 if equal , + value if greater than , - value if less than

compare

public static long compare(Duration duration,
                           java.lang.String value)

compare

public static long compare(java.util.Date date,
                           java.lang.String value)

compare

public static long compare(Time time,
                           java.lang.String value)

compare

public static long compare(java.util.Calendar calendar,
                           java.lang.String value)

getStringFromDatahandler

public static java.lang.String getStringFromDatahandler(javax.activation.DataHandler dataHandler)
Converts the given .datahandler to a string

Returns:
string

getObjectForClass

public static java.lang.Object getObjectForClass(java.lang.Class clazz,
                                                 java.lang.String value)
A reflection based method to generate an instance of a given class and populate it with a given value

Parameters:
clazz -
value -
Returns:
object

serializeAnyType

public static void serializeAnyType(java.lang.Object value,
                                    javax.xml.stream.XMLStreamWriter xmlStreamWriter)
                             throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getAnyTypeObject

public static java.lang.Object getAnyTypeObject(javax.xml.stream.XMLStreamReader xmlStreamReader,
                                                java.lang.Class extensionMapperClass)
                                         throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException


Copyright © 2007 Apache Web Services Project. All Rights Reserved.