Class MapiTypeConverter
- java.lang.Object
-
- microsoft.exchange.webservices.data.misc.MapiTypeConverter
-
public class MapiTypeConverter extends Object
Utility class to convert between MAPI Property type values and strings.
-
-
Constructor Summary
Constructors Constructor Description MapiTypeConverter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectchangeType(MapiPropertyType mapiType, Object value)Change value to a value of compatible type.static StringconvertToString(MapiPropertyType mapiPropType, Object value)Converts a value to a string.static ObjectconvertToValue(MapiPropertyType mapiPropType, String stringValue)Converts a string to value consistent with MAPI type.static List<Object>convertToValue(MapiPropertyType mapiPropType, Iterator<String> strings)Converts the string list to array.static Map<MapiPropertyType,MapiTypeConverterMapEntry>getMapiTypeConverterMap()Gets the MAPI type converter map.static booleanisArrayType(MapiPropertyType mapiType)Determines whether MapiPropertyType is an array type.protected static ObjectparseMapiIntegerValue(String s)Converts a MAPI Integer value.
-
-
-
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 typestringValue- the string value- Returns:
- the object
- Throws:
ServiceXmlDeserializationException- the service xml deserialization exceptionFormatException- the format exception
-
convertToString
public static String convertToString(MapiPropertyType mapiPropType, Object value)
Converts a value to a string.- Parameters:
mapiPropType- the mapi prop typevalue- 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 typevalue- 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
-
-