Class ConverterUtil
- java.lang.Object
-
- org.apache.axis2.databinding.utils.ConverterUtil
-
public class ConverterUtil extends Object
Converter methods to go from 1. simple type -> String 2. simple type -> Object 3. String -> simpletype 4. Object list -> array
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConverterUtil.ObjectConversionException
A simple exception that is thrown when the conversion fails
-
Field Summary
Fields Modifier and Type Field Description static String
SYSTEM_PROPERTY_ADB_CONVERTERUTIL
-
Constructor Summary
Constructors Constructor Description ConverterUtil()
-
Method Summary
-
-
-
Field Detail
-
SYSTEM_PROPERTY_ADB_CONVERTERUTIL
public static final String SYSTEM_PROPERTY_ADB_CONVERTERUTIL
- See Also:
- Constant Field Values
-
-
Method Detail
-
convertToString
public static String convertToString(int i)
-
convertToString
public static String convertToString(float i)
-
convertToString
public static String convertToString(long i)
-
convertToString
public static String convertToString(double i)
-
convertToString
public static String convertToString(byte i)
-
convertToString
public static String convertToString(char i)
-
convertToString
public static String convertToString(short i)
-
convertToString
public static String convertToString(boolean i)
-
appendTimeZone
public static void appendTimeZone(Calendar calendar, StringBuffer dateString)
-
appendDate
public static void appendDate(StringBuffer dateString, Calendar calendar)
-
appendTime
public static void appendTime(Calendar value, StringBuffer dateString)
-
convertToString
public static String convertToString(BigInteger o)
-
convertToString
public static String convertToString(UnsignedByte o)
-
convertToString
public static String convertToString(UnsignedInt o)
-
convertToString
public static String convertToString(UnsignedLong o)
-
convertToString
public static String convertToString(BigDecimal o)
-
convertToString
public static String convertToString(byte[] bytes)
-
convertToString
public static String convertToString(DataHandler handler)
-
convertToInt
public static int convertToInt(String s)
-
convertToBigDecimal
public static BigDecimal convertToBigDecimal(String s)
-
convertToDouble
public static double convertToDouble(String s)
-
convertToDecimal
public static BigDecimal convertToDecimal(String s)
-
convertToStandardDecimalNotation
public static BigDecimal convertToStandardDecimalNotation(String s)
-
convertToFloat
public static float convertToFloat(String s)
-
convertToLong
public static long convertToLong(String s)
-
convertToShort
public static short convertToShort(String s)
-
convertToBoolean
public static boolean convertToBoolean(String s)
-
convertToBase64Binary
public static DataHandler convertToBase64Binary(String s)
-
convertToDataHandler
public static DataHandler convertToDataHandler(String s)
-
convertToDate
public static Date convertToDate(String source)
Converts a given string into a date. Code from Axis1 DateDeserializer.- Parameters:
source
-- Returns:
- Returns Date.
-
convertXmlToDate
public static Date convertXmlToDate(String source)
Convert lexical representation of date to java.util.Date.- Parameters:
source
- the source- Returns:
- the date This method used to parse the lexical string representation defined in XML Schema 1.0 Part 2, Section 3.2.[7-14].1 to a java.util.Date based on XMLGregorianCalendar. This replaced the behavior of convertToDate() method that copied from Axis1 .
-
convertToNormalizedString
public static NormalizedString convertToNormalizedString(String s)
-
convertToUnsignedLong
public static UnsignedLong convertToUnsignedLong(String s)
-
convertToUnsignedInt
public static UnsignedInt convertToUnsignedInt(String s)
-
convertToUnsignedShort
public static UnsignedShort convertToUnsignedShort(String s)
-
convertToUnsignedByte
public static UnsignedByte convertToUnsignedByte(String s)
-
convertToNonNegativeInteger
public static NonNegativeInteger convertToNonNegativeInteger(String s)
-
convertToNegativeInteger
public static NegativeInteger convertToNegativeInteger(String s)
-
convertToPositiveInteger
public static PositiveInteger convertToPositiveInteger(String s)
-
convertToNonPositiveInteger
public static NonPositiveInteger convertToNonPositiveInteger(String s)
-
convertToInteger
public static BigInteger convertToInteger(String s)
-
convertToBigInteger
public static BigInteger convertToBigInteger(String s)
-
convertToByte
public static byte convertToByte(String s)
-
convertToDateTime
public static Calendar convertToDateTime(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(String source, String nameSpaceuri)
Code from Axis1 code base- Parameters:
source
-- Returns:
- Returns QName.
-
convertToObject
public static Object convertToObject(boolean i)
-
convertToObject
public static Object convertToObject(double i)
-
convertToObject
public static Object convertToObject(byte i)
-
convertToObject
public static Object convertToObject(char i)
-
convertToObject
public static Object convertToObject(short i)
-
convertToArray
public static Object convertToArray(Class baseArrayClass, List objectList)
- Parameters:
baseArrayClass
-objectList
- -> for primitive type array conversion we assume the content to be strings!- Returns:
- Returns Object.
-
toList
public static List toList(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, String value)
- Parameters:
intValue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static double compare(double doubleValue, String value)
- Parameters:
doubleValue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static float compare(float floatValue, String value)
- Parameters:
floatValue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static long compare(long longValue, String value)
- Parameters:
longValue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static int compare(short shortValue, String value)
- Parameters:
shortValue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static int compare(byte byteVlaue, String value)
- Parameters:
byteVlaue
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static long compare(BigInteger binBigInteger, String value)
- Parameters:
binBigInteger
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static double compare(BigDecimal binBigDecimal, String value)
- Parameters:
binBigDecimal
-value
-- Returns:
- 0 if equal , + value if greater than , - value if less than
-
compare
public static long compare(UnsignedLong unsignedLong, String value)
-
getStringFromDatahandler
public static String getStringFromDatahandler(DataHandler dataHandler)
Converts the given .datahandler to a string- Returns:
- string
-
getObjectForClass
public static Object getObjectForClass(Class clazz, 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(Object value, XMLStreamWriter xmlStreamWriter) throws XMLStreamException
- Throws:
XMLStreamException
-
getAnyTypeObject
public static Object getAnyTypeObject(XMLStreamReader xmlStreamReader, Class extensionMapperClass) throws XMLStreamException
- Throws:
XMLStreamException
-
-