Class AnyConverter
All public methods take an Object argument that either is the immediate object, such as Boolean, Type, interface implementation, or an Any that contains an object.
The methods which extract the value do a widening conversion. See the method comments for the respective conversions.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic TypeDetermines the type of an Any object.static booleanChecks if the any contains UNO idl sequence value (meaning a java array containing elements which are values of UNO idl types).static booleanChecks if the any contains a value of the idl typeboolean.static booleanChecks if the any contains a value of the idl typebyte.static booleanChecks if the any contains a value of the idl typechar.static booleanChecks if the any contains a value of the idl typedouble.static booleanChecks if the any contains a value of the idl typeenum.static booleanChecks if the any contains a value of the idl typefloat.static booleanChecks if the any contains a value of the idl typelong(which maps to a java-int).static booleanChecks if the any contains a value of the idl typehyper(which maps to a java-long).static booleanChecks if the any contains an interface, struct, exception, sequence or enum.static booleanChecks if the any contains a value of the idl typeshort.static booleanChecks if the any contains a value of the idl typestring.static booleanChecks if the any contains a value of the idl typetype.static booleanChecks if the any contains the idl typevoid.static ObjectConverts an array or an any containing an array into an array.static booleanConverts a Boolean object or an Any object containing a Boolean object into a simple boolean.static byteConverts a Byte object or an Any object containing a Byte object into a simple byte.static charConverts a Char object or an Any object containing a Char object into a simple char.static doubleConverts a number object into a simple double and allows widening conversions.static floatConverts a number object into a simple float and allows widening conversions.static intConverts a number object into a simple int and allows widening conversions.static longConverts a number object into a simple long and allows widening conversions.static ObjectConverts a UNO object (struct, exception, sequence, enum or interface) or an Any containing these types into a UNO object of a specified destination type.static ObjectConverts a UNO object (struct, exception, sequence, enum or interface) or an Any containing these types into a UNO object of a specified destination type.static shortConverts a number object into a simple short and allows widening conversions.static StringConverts a string or an any containing a string into a string.static TypeConverts a Type or an any containing a Type into a Type.static inttoUnsignedInt(Object object) Converts a number object into an idl unsigned long and allows widening conversions.static longtoUnsignedLong(Object object) Converts a number object into an idl unsigned hyper and allows widening conversions.static shorttoUnsignedShort(Object object) Converts a number object into an idl unsigned short and allows widening conversions.
- 
Constructor Details- 
AnyConverterpublic AnyConverter()
 
- 
- 
Method Details- 
getTypeDetermines the type of an Any object.- Parameters:
- object- any object.
- Returns:
- type object.
 
- 
isVoidChecks if the any contains the idl typevoid.- Parameters:
- object- the object to check.
- Returns:
- true when the any is void, false otherwise.
 
- 
isCharChecks if the any contains a value of the idl typechar.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a char, false otherwise.
 
- 
isBooleanChecks if the any contains a value of the idl typeboolean.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a boolean, false otherwise.
 
- 
isByteChecks if the any contains a value of the idl typebyte.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a byte, false otherwise.
 
- 
isShortChecks if the any contains a value of the idl typeshort.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a short, false otherwise.
 
- 
isIntChecks if the any contains a value of the idl typelong(which maps to a java-int).- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a int, false otherwise.
 
- 
isLongChecks if the any contains a value of the idl typehyper(which maps to a java-long).- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a long, false otherwise.
 
- 
isFloatChecks if the any contains a value of the idl typefloat.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a float, false otherwise.
 
- 
isDoubleChecks if the any contains a value of the idl typedouble.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a double, false otherwise.
 
- 
isStringChecks if the any contains a value of the idl typestring.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a string, false otherwise.
 
- 
isEnumChecks if the any contains a value of the idl typeenum.- Parameters:
- object- the object to check.
- Returns:
- true if the any contains an enum, false otherwise.
 
- 
isTypeChecks if the any contains a value of the idl typetype.- Parameters:
- object- the object to check.
- Returns:
- true when the any contains a type, false otherwise.
 
- 
isObjectChecks if the any contains an interface, struct, exception, sequence or enum.If object is an any with an interface type, then true is also returned if the any contains a null reference. This is because interfaces are allowed to have a null value contrary to other UNO types. - Parameters:
- object- the object to check.
- Returns:
- true if the any contains an object.
 
- 
isArrayChecks if the any contains UNO idl sequence value (meaning a java array containing elements which are values of UNO idl types).- Parameters:
- object- the object to check.
- Returns:
- true when the any contains an object which implements interfaces, false otherwise.
 
- 
toCharConverts a Char object or an Any object containing a Char object into a simple char.- Parameters:
- object- the object to convert.
- Returns:
- the char contained within the object.
- Throws:
- IllegalArgumentException- in case no char is contained within object.
- See Also:
 
- 
toBooleanConverts a Boolean object or an Any object containing a Boolean object into a simple boolean.- Parameters:
- object- the object to convert.
- Returns:
- the boolean contained within the object
- Throws:
- IllegalArgumentException- in case no boolean is contained within object
- See Also:
 
- 
toByteConverts a Byte object or an Any object containing a Byte object into a simple byte.- Parameters:
- object- the object to convert.
- Returns:
- the boolean contained within the object.
- Throws:
- IllegalArgumentException- in case no byte is contained within object.
- See Also:
 
- 
toShortConverts a number object into a simple short and allows widening conversions.Allowed argument types are Byte, Short or Any containing these types. - Parameters:
- object- the object to convert.
- Returns:
- the short contained within the object.
- Throws:
- IllegalArgumentException- in case no short or byte is contained within object.
 
- 
toUnsignedShortConverts a number object into an idl unsigned short and allows widening conversions.Allowed argument types are Anies containing idl unsigned short values. - Parameters:
- object- the object to convert.
- Returns:
- an (unsigned) short.
- Throws:
- IllegalArgumentException- in case no idl unsigned short is contained within Any.
 
- 
toIntConverts a number object into a simple int and allows widening conversions.Allowed argument types are Byte, Short, Integer or Any containing these types. - Parameters:
- object- the object to convert.
- Returns:
- the int contained within the object.
- Throws:
- IllegalArgumentException- in case no short, byte or int is contained within object.
 
- 
toUnsignedIntConverts a number object into an idl unsigned long and allows widening conversions.Allowed argument types are Anies containing idl unsigned short or unsigned long values. - Parameters:
- object- the object to convert.
- Returns:
- an (unsigned) int.
- Throws:
- IllegalArgumentException- in case no idl unsigned short nor unsigned long is contained within Any.
 
- 
toLongConverts a number object into a simple long and allows widening conversions.Allowed argument types are Byte, Short, Integer, Long or Any containing these types. - Parameters:
- object- the object to convert.
- Returns:
- the long contained within the object.
- Throws:
- IllegalArgumentException- in case no short, byte, int or long is contained within object.
 
- 
toUnsignedLongConverts a number object into an idl unsigned hyper and allows widening conversions.Allowed argument types are Anies containing idl unsigned short, unsigned long or unsigned hyper values. - Parameters:
- object- the object to convert.
- Returns:
- an (unsigned) long.
- Throws:
- IllegalArgumentException- in case no idl unsigned short, nor unsigned long nor unsigned hyper is contained within object.
 
- 
toFloatConverts a number object into a simple float and allows widening conversions.Allowed argument types are Byte, Short, Float or Any containing these types. - Parameters:
- object- the object to convert.
- Returns:
- the float contained within the object.
- Throws:
- IllegalArgumentException- in case no byte, short or float is contained within object.
 
- 
toDoubleConverts a number object into a simple double and allows widening conversions.Allowed argument types are Byte, Short, Int, Float, Double or Any containing these types. - Parameters:
- object- the object to convert.
- Returns:
- the double contained within the object.
- Throws:
- IllegalArgumentException- in case no byte, short, int, float or double is contained within object.
 
- 
toStringConverts a string or an any containing a string into a string.- Parameters:
- object- the object to convert.
- Returns:
- the string contained within the object.
- Throws:
- IllegalArgumentException- in case no string is contained within object.
 
- 
toTypeConverts a Type or an any containing a Type into a Type.- Parameters:
- object- the object to convert.
- Returns:
- the type contained within the object.
- Throws:
- IllegalArgumentException- in case no type is contained within object.
 
- 
toObjectConverts a UNO object (struct, exception, sequence, enum or interface) or an Any containing these types into a UNO object of a specified destination type.For interfaces, the argument object is queried for the interface specified by the type argument. That query (UnoRuntime.queryInterface) might return null, if the interface is not implemented or a null-ref or a VOID any is given. - Parameters:
- type- type of the returned value.
- object- the object that is to be converted.
- Returns:
- destination object.
- Throws:
- IllegalArgumentException- in case conversion is not possible.
 
- 
toObjectConverts a UNO object (struct, exception, sequence, enum or interface) or an Any containing these types into a UNO object of a specified destination type.For interfaces, the argument object is queried for the interface specified by the type argument. That query (UnoRuntime.queryInterface) might return null, if the interface is not implemented or a null-ref or a VOID any is given. - Parameters:
- clazz- class of the returned value.
- object- the object that is to be converted.
- Returns:
- destination object.
- Throws:
- IllegalArgumentException- in case conversion is not possible.
 
- 
toArrayConverts an array or an any containing an array into an array.- Parameters:
- object- the object to convert.
- Returns:
- the array contained within the object.
- Throws:
- IllegalArgumentException- in case no array is contained within object.
 
 
-