Top Description Inners Fields Constructors Methods
com.sun.star.uno

public Class Type

extends Object
Class Inheritance
Imports
java.util.HashMap, com.sun.star.lib.uno.typedesc.TypeDescription

Represents the UNO built-in type TYPE.

The UNO type is not directly mapped to java.lang.Class for at least two reasons. For one, some UNO types (like UNSIGNED SHORT) do not have a matching Java class. For another, it can be necessary to describe a type which is unknown to the Java runtime system (for example, for delaying the need of a class, so that it is possible to generate it on the fly.)

A Type is uniquely determined by its type class (a TypeClass) and its type name (a String); these two will never be null. A Type may have an additional "z class" (a java.lang.Class), giving a Java class type that corresponds to the UNO type. Also, a Type can cache a type description (a com.sun.star.uno.typedesc.TypeDescription), which can be computed and set by TypeDescription.getTypeDescription.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final HashMap<Class<?>, Type.TypeInfo>
private static final String[]
private Class<?>
private TypeDescription
private com.sun.star.uno.TypeClass
private String
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
public static final Type
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
public static final Type
public static final Type
public static final Type
public static final Type

Constructor Summary

AccessConstructor and Description
public
Type()

Constructs a new Type which defaults to VOID.

public
Type(String
the type name. Must not be null.
typeName
,
com.sun.star.uno.TypeClass
the type class. Must not be null, and must match the typeName (for example, it is illegal to combine a typeName of "void" with a typeClass of BOOLEAN).
typeClass
)

Constructs a new Type with the given type class and type name.

public
Type(Class<?>
the Java class of this type. Must not be null.
zClass
)

Constructs a new Type from the given java.lang.Class.

public
Type(Class<?>
the Java class of this type; must not be null
zClass
,
boolean
controls which UNO type to choose in case of ambiguities
alternative
)

Constructs a new Type from the given java.lang.Class, handling ambiguous cases.

private
Type(Class<?> zClass, boolean alternative, boolean sequenceComponentType)

public
Type(TypeDescription
a type description. Must not be null.
typeDescription
)

Constructs a new Type from the given type description.

public
Type(String
the name of this type; must not be null.
typeName
)

Constructs a new Type with the given type name.

public
Type(com.sun.star.uno.TypeClass
the type class of this type; must not be null. Only type classes for simple types are allowed here.
typeClass
)

Constructs a new Type with the given type class.

Method Summary

Modifier and TypeMethod and Description
private static boolean
__isTypeClassPrimitive(com.sun.star.uno.TypeClass typeClass)

private Class<?>
public boolean

Returns:

true if this object is the same as the obj argument; false otherwise.
equals
(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is equal to this one.

public com.sun.star.uno.TypeClass

Returns:

the type class. Will never be null, but might be UNKNOWN.
getTypeClass
()

Gets the type class.

public TypeDescription

Returns:

the type description; may be null
getTypeDescription
()

Gives the type description of this type.

public String

Returns:

the type name; will never be null
getTypeName
()

Gets the type name.

public Class<?>

Returns:

the type name; may be null in extreme situations (inconsistent TypeClass, error loading a class)
getZClass
()

Gets the Java class.

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.

private void
init(String name, Class<?> zClass, boolean alternative, boolean arguments, boolean sequenceComponentType)

public boolean

Returns:

true if this type is a supertype of the given type
isSupertypeOf
(Type
some Type
type
)

Determines whether this UNO type is a supertype of another UNO type.

public void
setTypeDescription(TypeDescription
the type description
typeDescription
)

Sets the type description for this type.

public String

Returns:

a string representation of the object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

__javaClassToTypeClassback to summary
private static final HashMap<Class<?>, Type.TypeInfo> __javaClassToTypeClass
__typeClassToTypeNameback to summary
private static final String[] __typeClassToTypeName
_classback to summary
private Class<?> _class
_iTypeDescriptionback to summary
private TypeDescription _iTypeDescription
_typeClassback to summary
private com.sun.star.uno.TypeClass _typeClass
_typeNameback to summary
private String _typeName
ANYback to summary
public static final Type ANY
BOOLEANback to summary
public static final Type BOOLEAN
BYTEback to summary
public static final Type BYTE
CHARback to summary
public static final Type CHAR
DOUBLEback to summary
public static final Type DOUBLE
FLOATback to summary
public static final Type FLOAT
HYPERback to summary
public static final Type HYPER
LONGback to summary
public static final Type LONG
SHORTback to summary
public static final Type SHORT
STRINGback to summary
public static final Type STRING
TYPEback to summary
public static final Type TYPE
TYPE_NAME_ANYback to summary
private static final String TYPE_NAME_ANY
TYPE_NAME_BOOLEANback to summary
private static final String TYPE_NAME_BOOLEAN
TYPE_NAME_BYTEback to summary
private static final String TYPE_NAME_BYTE
TYPE_NAME_CHARback to summary
private static final String TYPE_NAME_CHAR
TYPE_NAME_DOUBLEback to summary
private static final String TYPE_NAME_DOUBLE
TYPE_NAME_FLOATback to summary
private static final String TYPE_NAME_FLOAT
TYPE_NAME_HYPERback to summary
private static final String TYPE_NAME_HYPER
TYPE_NAME_LONGback to summary
private static final String TYPE_NAME_LONG
TYPE_NAME_SHORTback to summary
private static final String TYPE_NAME_SHORT
TYPE_NAME_STRINGback to summary
private static final String TYPE_NAME_STRING
TYPE_NAME_TYPEback to summary
private static final String TYPE_NAME_TYPE
TYPE_NAME_UNSIGNED_HYPERback to summary
private static final String TYPE_NAME_UNSIGNED_HYPER
TYPE_NAME_UNSIGNED_LONGback to summary
private static final String TYPE_NAME_UNSIGNED_LONG
TYPE_NAME_UNSIGNED_SHORTback to summary
private static final String TYPE_NAME_UNSIGNED_SHORT
TYPE_NAME_VOIDback to summary
private static final String TYPE_NAME_VOID
UNSIGNED_HYPERback to summary
public static final Type UNSIGNED_HYPER
UNSIGNED_LONGback to summary
public static final Type UNSIGNED_LONG
UNSIGNED_SHORTback to summary
public static final Type UNSIGNED_SHORT
VOIDback to summary
public static final Type VOID

Constructor Detail

Typeback to summary
public Type()

Constructs a new Type which defaults to VOID.

Typeback to summary
public Type(String typeName, com.sun.star.uno.TypeClass typeClass)

Constructs a new Type with the given type class and type name.

Parameters
typeName:String

the type name. Must not be null.

typeClass:com.sun.star.uno.TypeClass

the type class. Must not be null, and must match the typeName (for example, it is illegal to combine a typeName of "void" with a typeClass of BOOLEAN).

Typeback to summary
public Type(Class<?> zClass)

Constructs a new Type from the given java.lang.Class.

This is equivalent to Type(zClass, false).

Parameters
zClass:Class<?>

the Java class of this type. Must not be null.

Typeback to summary
public Type(Class<?> zClass, boolean alternative)

Constructs a new Type from the given java.lang.Class, handling ambiguous cases.

In certain cases, one Java class corresponds to two UNO types (e.g., the Java class short[].class corresponds to both a sequence of SHORT and a sequence of UNSIGNED SHORT in UNO). In such ambiguous cases, the parameter alternative controls which UNO type is chosen:

  • If the Java type is (an array type with element type) short or java.lang.Short: If alternative is false, the chosen UNO type is (a sequence type with element type) SHORT. If alternative is true, the chosen UNO type is (a sequence type with element type) UNSIGNED SHORT.
  • If the Java type is (an array type with element type) int or java.lang.Integer: If alternative is false, the chosen UNO type is (a sequence type with element type) LONG. If alternative is true, the chosen UNO type is (a sequence type with element type) UNSIGNED LONG.
  • If the Java type is (an array type with element type) long or java.lang.Long: If alternative is false, the chosen UNO type is (a sequence type with element type) HYPER. If alternative is true, the chosen UNO type is (a sequence type with element type) UNSIGNED HYPER.
  • If the Java type is (an array type with element type) java.lang.Object: If alternative is false, the chosen UNO type is (a sequence type with element type) ANY. If alternative is true, the chosen UNO type is (a sequence type with element type) com.sun.star.uno.XInterface.

In all other cases, the value of alternative is ignored.

This constructor cannot be used to create Type instances that represent (sequences of) instantiated polymorphic struct types.

Parameters
zClass:Class<?>

the Java class of this type; must not be null

alternative:boolean

controls which UNO type to choose in case of ambiguities

Since
UDK 3.2.0
Typeback to summary
private Type(Class<?> zClass, boolean alternative, boolean sequenceComponentType)
Typeback to summary
public Type(TypeDescription typeDescription)

Constructs a new Type from the given type description. For internal URE use only. Not to be used by client code.

Parameters
typeDescription:TypeDescription

a type description. Must not be null.

Typeback to summary
public Type(String typeName)

Constructs a new Type with the given type name.

Parameters
typeName:String

the name of this type; must not be null.

Typeback to summary
public Type(com.sun.star.uno.TypeClass typeClass)

Constructs a new Type with the given type class.

Parameters
typeClass:com.sun.star.uno.TypeClass

the type class of this type; must not be null. Only type classes for simple types are allowed here.

Exceptions
IllegalArgumentException:
if the given typeClass is not simple (for example, a struct or an interface type). This constructor could not find out the type name in such a case.

Method Detail

__isTypeClassPrimitiveback to summary
private static boolean __isTypeClassPrimitive(com.sun.star.uno.TypeClass typeClass)
determineClassback to summary
private Class<?> determineClass()
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is equal to this one.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
See Also
java.lang.Object#equals
getTypeClassback to summary
public com.sun.star.uno.TypeClass getTypeClass()

Gets the type class.

Returns:com.sun.star.uno.TypeClass

the type class. Will never be null, but might be UNKNOWN.

getTypeDescriptionback to summary
public TypeDescription getTypeDescription()

Gives the type description of this type. For internal URE use only. Not to be used by client code.

Returns:TypeDescription

the type description; may be null

getTypeNameback to summary
public String getTypeName()

Gets the type name.

Returns:String

the type name; will never be null

getZClassback to summary
public Class<?> getZClass()

Gets the Java class.

Returns:Class<?>

the type name; may be null in extreme situations (inconsistent TypeClass, error loading a class)

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.

Returns:int

a hash code value for this object.

Annotations
@Override
See Also
java.lang.Object#hashCode
initback to summary
private void init(String name, Class<?> zClass, boolean alternative, boolean arguments, boolean sequenceComponentType)
isSupertypeOfback to summary
public boolean isSupertypeOf(Type type)

Determines whether this UNO type is a supertype of another UNO type. UNO only defines the following supertype relations: (1) A struct type t1 is a supertype of a struct type t2, if either t1 and t2 are the same, or t1 is a direct or indirect parent of t2. (2) An exception type t1 is a supertype of an exception type t2, if either t1 and t2 are the same, or t1 is a direct or indirect parent of t2. (3) An interface type t1 is a supertype of an interface type t2, if either t1 and t2 are the same, or t1 is a direct or indirect parent of t2. Following the conventions of the Java UNO language binding, com.sun.star.uno.Exception is not considered a supertype of com.sun.star.uno.RuntimeException or any exception type derived from com.sun.star.uno.RuntimeException.

Parameters
type:Type

some Type

Returns:boolean

true if this type is a supertype of the given type

Since
UDK 3.2.0
setTypeDescriptionback to summary
public void setTypeDescription(TypeDescription typeDescription)

Sets the type description for this type. For internal URE use only. Not to be used by client code.

Parameters
typeDescription:TypeDescription

the type description

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
See Also
java.lang.Object#toString
com.sun.star.uno back to summary

private final Class Type.TypeInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final com.sun.star.uno.TypeClass
pack-priv final com.sun.star.uno.TypeClass
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
TypeInfo(com.sun.star.uno.TypeClass thePrimary, com.sun.star.uno.TypeClass theAlternative, boolean theSequenceComponentType)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alternativeback to summary
pack-priv final com.sun.star.uno.TypeClass alternative
primaryback to summary
pack-priv final com.sun.star.uno.TypeClass primary
sequenceComponentTypeback to summary
pack-priv final boolean sequenceComponentType

Constructor Detail

TypeInfoback to summary
pack-priv TypeInfo(com.sun.star.uno.TypeClass thePrimary, com.sun.star.uno.TypeClass theAlternative, boolean theSequenceComponentType)