Class MapiTypeConverterMapEntry
- java.lang.Object
-
- microsoft.exchange.webservices.data.misc.MapiTypeConverterMapEntry
-
public class MapiTypeConverterMapEntry extends Object
Represents an entry in the MapiTypeConverter map.
-
-
Constructor Summary
Constructors Constructor Description MapiTypeConverterMapEntry(Class<?> type)Initializes a new instance of the MapiTypeConverterMapEntry class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectchangeType(Object value)Change value to a value of compatible type.ObjectconvertToValue(String stringValue)Converts a string to value consistent with type.ObjectconvertToValueOrDefault(String stringValue)Converts a string to value consistent with type (or uses the default value if the string is null or empty).protected IFunction<Object,String>getConvertToString()Gets the string to object converter.protected ObjectgetDefaultValue()Gets the default value for the type.static intgetDim(Object array)Gets the dim.booleangetIsArray()Gets a value indicating whether this instance is array.protected IFunction<String,Object>getParse()Gets the string parser.Class<?>getType()Gets the type.protected voidsetConvertToString(IFunction<Object,String> value)Sets the string to object converter.protected voidsetIsArray(boolean value)Sets the checks if is array.protected voidsetParse(IFunction<String,Object> value)Sets the string parser.voidsetType(Class<?> cls)Sets the type.
-
-
-
Constructor Detail
-
MapiTypeConverterMapEntry
public MapiTypeConverterMapEntry(Class<?> type)
Initializes a new instance of the MapiTypeConverterMapEntry class.- Parameters:
type- The type. y default, converting a type to string is done by calling value.ToString. Instances can override this behavior. By default, converting a string to the appropriate value type is done by calling Convert.ChangeType Instances may override this behavior.
-
-
Method Detail
-
changeType
public Object changeType(Object value) throws Exception
Change value to a value of compatible type. The type of a simple value should match exactly or be convertible to the appropriate type. An array value has to be a single dimension (rank), contain at least one value and contain elements that exactly match the expected type. (We could relax this last requirement so that, for example, you could pass an array of Int32 that could be converted to an array of Double but that seems like overkill).- Parameters:
value- The value.- Returns:
- New value.
- Throws:
Exception- the exception
-
convertToValue
public Object convertToValue(String stringValue) throws ServiceXmlDeserializationException, FormatException
Converts a string to value consistent with type. For array types, this method is called for each array element.- Parameters:
stringValue- String to convert to a value.- Returns:
- value
- Throws:
ServiceXmlDeserializationException- the service xml deserialization exceptionFormatException- the format exception
-
convertToValueOrDefault
public Object convertToValueOrDefault(String stringValue) throws ServiceXmlDeserializationException, FormatException
Converts a string to value consistent with type (or uses the default value if the string is null or empty).- Parameters:
stringValue- to convert to a value.- Returns:
- Value.
- Throws:
FormatExceptionServiceXmlDeserializationException
-
getDim
public static int getDim(Object array)
Gets the dim. If `array' is an array object returns its dimensions; otherwise returns 0- Parameters:
array- the array- Returns:
- the dim
-
getIsArray
public boolean getIsArray()
Gets a value indicating whether this instance is array.- Returns:
- the checks if is array
-
setIsArray
protected void setIsArray(boolean value)
Sets the checks if is array.- Parameters:
value- the new checks if is array
-
getConvertToString
protected IFunction<Object,String> getConvertToString()
Gets the string to object converter. For array types, this method is called for each array element.- Returns:
- the convert to string
-
setConvertToString
protected void setConvertToString(IFunction<Object,String> value)
Sets the string to object converter.- Parameters:
value- the value
-
getParse
protected IFunction<String,Object> getParse()
Gets the string parser. For array types, this method is called for each array element.- Returns:
- the parses the
-
setParse
protected void setParse(IFunction<String,Object> value)
Sets the string parser.- Parameters:
value- the value
-
getDefaultValue
protected Object getDefaultValue()
Gets the default value for the type.- Returns:
- Type
-
-