microsoft.exchange.webservices.data.misc
Class MapiTypeConverter

java.lang.Object
  extended by microsoft.exchange.webservices.data.misc.MapiTypeConverter

public class MapiTypeConverter
extends Object

Utility class to convert between MAPI Property type values and strings.


Constructor Summary
MapiTypeConverter()
           
 
Method Summary
static Object changeType(MapiPropertyType mapiType, Object value)
          Change value to a value of compatible type.
static String convertToString(MapiPropertyType mapiPropType, Object value)
          Converts a value to a string.
static List<Object> convertToValue(MapiPropertyType mapiPropType, Iterator<String> strings)
          Converts the string list to array.
static Object convertToValue(MapiPropertyType mapiPropType, String stringValue)
          Converts a string to value consistent with MAPI type.
static Map<MapiPropertyType,MapiTypeConverterMapEntry> getMapiTypeConverterMap()
          Gets the MAPI type converter map.
static boolean isArrayType(MapiPropertyType mapiType)
          Determines whether MapiPropertyType is an array type.
protected static Object parseMapiIntegerValue(String s)
          Converts a MAPI Integer value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapiTypeConverter

public MapiTypeConverter()
Method Detail

convertToValue

public static List<Object> convertToValue(MapiPropertyType mapiPropType,
                                          Iterator<String> strings)
                                   throws Exception
Converts the string list to array.

Parameters:
mapiPropType - Type of the MAPI property.
strings - the strings
Returns:
Array of objects.
Throws:
Exception - the exception

convertToValue

public static Object convertToValue(MapiPropertyType mapiPropType,
                                    String stringValue)
                             throws ServiceXmlDeserializationException,
                                    FormatException
Converts a string to value consistent with MAPI type.

Parameters:
mapiPropType - the mapi prop type
stringValue - the string value
Returns:
the object
Throws:
ServiceXmlDeserializationException - the service xml deserialization exception
FormatException - the format exception

convertToString

public static String convertToString(MapiPropertyType mapiPropType,
                                     Object value)
Converts a value to a string.

Parameters:
mapiPropType - the mapi prop type
value - the value
Returns:
String value.

changeType

public static Object changeType(MapiPropertyType mapiType,
                                Object value)
                         throws Exception
Change value to a value of compatible type.

Parameters:
mapiType - the mapi type
value - the value
Returns:
the object
Throws:
Exception - the exception

parseMapiIntegerValue

protected static Object parseMapiIntegerValue(String s)
Converts a MAPI Integer value. Usually the value is an integer but there are cases where the value has been "schematized" to an Enumeration value (e.g. NoData) which we have no choice but to fallback and represent as a string.

Parameters:
s - The string value.
Returns:
Integer value or the original string if the value could not be parsed as such.

isArrayType

public static boolean isArrayType(MapiPropertyType mapiType)
Determines whether MapiPropertyType is an array type.

Parameters:
mapiType - the mapi type
Returns:
true, if is array type

getMapiTypeConverterMap

public static Map<MapiPropertyType,MapiTypeConverterMapEntry> getMapiTypeConverterMap()
Gets the MAPI type converter map.

Returns:
the mapi type converter map


Copyright © 2012–2015 Microsoft. All rights reserved.