FileDocCategorySizeDatePackage
Types.javaAPI DocJava SE 5 API5801Fri Aug 26 14:55:16 BST 2005com.sun.mirror.util

Types

public interface Types
Utility methods for operating on types.
author
Joseph D. Darcy
author
Scott Seligman
version
1.3 04/06/07
since
1.5

Fields Summary
Constructors Summary
Methods Summary
public com.sun.mirror.type.ArrayTypegetArrayType(com.sun.mirror.type.TypeMirror componentType)
Returns an array type with the specified component type.

param
componentType the component type
return
an array type with the specified component type.
throws
IllegalArgumentException if the component type is not valid for an array

public com.sun.mirror.type.DeclaredTypegetDeclaredType(com.sun.mirror.type.DeclaredType containing, com.sun.mirror.declaration.TypeDeclaration decl, com.sun.mirror.type.TypeMirror typeArgs)
Returns the type corresponding to a type declaration and actual arguments, given a {@linkplain DeclaredType#getContainingType() containing type} of which it is a member. The parameterized type {@code Outer.Inner}, for example, may be constructed by first using {@link #getDeclaredType(TypeDeclaration, TypeMirror...)} to get the type {@code Outer}, and then invoking this method.

If the containing type is a parameterized type, the number of type arguments must equal the number of the declaration's formal type parameters. If it is not parameterized or if it is null, this method is equivalent to getDeclaredType(decl, typeArgs).

param
containing the containing type, or null if none
param
decl the type declaration
param
typeArgs the actual type arguments
return
the type corresponding to the type declaration and actual type arguments, contained within the given type
throws
IllegalArgumentException if too many or too few type arguments are given, or if an inappropriate type argument, declaration, or containing type is provided

public com.sun.mirror.type.DeclaredTypegetDeclaredType(com.sun.mirror.declaration.TypeDeclaration decl, com.sun.mirror.type.TypeMirror typeArgs)
Returns the type corresponding to a type declaration and actual type arguments. Given the declaration for String, for example, this method may be used to get the String type. It may then be invoked a second time, with the declaration for Set, to make the parameterized type {@code Set}.

The number of type arguments must either equal the number of the declaration's formal type parameters, or must be zero. If zero, and if the declaration is generic, then the declaration's raw type is returned.

If a parameterized type is being returned, its declaration must not be contained within a generic outer class. The parameterized type {@code Outer.Inner}, for example, may be constructed by first using this method to get the type {@code Outer}, and then invoking {@link #getDeclaredType(DeclaredType, TypeDeclaration, TypeMirror...)}.

param
decl the type declaration
param
typeArgs the actual type arguments
return
the type corresponding to the type declaration and actual type arguments
throws
IllegalArgumentException if too many or too few type arguments are given, or if an inappropriate type argument or declaration is provided

public com.sun.mirror.type.TypeMirrorgetErasure(com.sun.mirror.type.TypeMirror t)
Returns the erasure of a type.

param
t the type to be erased
return
the erasure of the given type

public com.sun.mirror.type.PrimitiveTypegetPrimitiveType(com.sun.mirror.type.PrimitiveType$Kind kind)
Returns a primitive type.

param
kind the kind of primitive type to return
return
a primitive type

public com.sun.mirror.type.TypeVariablegetTypeVariable(com.sun.mirror.declaration.TypeParameterDeclaration tparam)
Returns the type variable declared by a type parameter.

param
tparam the type parameter
return
the type variable declared by the type parameter

public com.sun.mirror.type.VoidTypegetVoidType()
Returns the pseudo-type representing the type of void.

return
the pseudo-type representing the type of void

public com.sun.mirror.type.WildcardTypegetWildcardType(java.util.Collection upperBounds, java.util.Collection lowerBounds)
Returns a new wildcard. Either the wildcards's upper bounds or lower bounds may be specified, or neither, but not both.

param
upperBounds the upper bounds of this wildcard, or an empty collection if none
param
lowerBounds the lower bounds of this wildcard, or an empty collection if none
return
a new wildcard
throws
IllegalArgumentException if bounds are not valid

public booleanisAssignable(com.sun.mirror.type.TypeMirror t1, com.sun.mirror.type.TypeMirror t2)
Tests whether one type is assignable to another.

param
t1 the first type
param
t2 the second type
return
true if and only if the first type is assignable to the second

public booleanisSubtype(com.sun.mirror.type.TypeMirror t1, com.sun.mirror.type.TypeMirror t2)
Tests whether one type is a subtype of the another. Any type is considered to be a subtype of itself.

param
t1 the first type
param
t2 the second type
return
true if and only if the first type is a subtype of the second