JType 0.1.1-redhat-2

com.googlecode.jtype
Class Types

java.lang.Object
  extended by com.googlecode.jtype.Types

public final class Types
extends Object

Factory for creating types.

Version:
$Id: Types.java 37 2009-07-24 11:27:39Z markhobson $
Author:
Mark Hobson
See Also:
Type

Method Summary
static GenericArrayType genericArrayType(Type componentType)
          Creates a generic array type for the specified component type.
static WildcardType lowerBoundedWildcardType(Type lowerBound)
          Creates a wildcard type with the specified lower bound.
static ParameterizedType parameterizedType(Class<?> rawType, Type... actualTypeArguments)
          Creates a parameterized type for the specified raw type and actual type arguments.
static
<D extends GenericDeclaration>
TypeVariable<D>
typeVariable(D declaration, String name, Type... bounds)
          Creates a type variable for the specified declaration, name and bounds.
static WildcardType unboundedWildcardType()
          Creates an unbounded wildcard type.
static WildcardType upperBoundedWildcardType(Type upperBound)
          Creates a wildcard type with the specified upper bound.
static Type valueOf(String typeName)
          Returns a type that corresponds to the specified string.
static Type valueOf(String typeName, Set<String> imports)
          Returns a type that corresponds to the specified string using the specified import context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

typeVariable

public static <D extends GenericDeclaration> TypeVariable<D> typeVariable(D declaration,
                                                                          String name,
                                                                          Type... bounds)
Creates a type variable for the specified declaration, name and bounds.

Type Parameters:
D - the type of generic declaration that declared the type variable
Parameters:
declaration - the generic declaration that declared the type variable
name - the name of the type variable
bounds - the upper bounds of the type variable
Returns:
the type variable

genericArrayType

public static GenericArrayType genericArrayType(Type componentType)
Creates a generic array type for the specified component type.

Parameters:
componentType - the component type
Returns:
the generic array type

parameterizedType

public static ParameterizedType parameterizedType(Class<?> rawType,
                                                  Type... actualTypeArguments)
Creates a parameterized type for the specified raw type and actual type arguments.

Parameters:
rawType - the raw type
actualTypeArguments - the actual type arguments
Returns:
the parameterized type
Throws:
MalformedParameterizedTypeException - if the number of actual type arguments differs from those defined on the raw type

unboundedWildcardType

public static WildcardType unboundedWildcardType()
Creates an unbounded wildcard type.

Returns:
the wildcard type

upperBoundedWildcardType

public static WildcardType upperBoundedWildcardType(Type upperBound)
Creates a wildcard type with the specified upper bound.

Parameters:
upperBound - the upper bound type
Returns:
the wildcard type

lowerBoundedWildcardType

public static WildcardType lowerBoundedWildcardType(Type lowerBound)
Creates a wildcard type with the specified lower bound.

Parameters:
lowerBound - the lower bound type
Returns:
the wildcard type

valueOf

public static Type valueOf(String typeName)
Returns a type that corresponds to the specified string.

Parameters:
typeName - the string to be parsed
Returns:
the type

valueOf

public static Type valueOf(String typeName,
                           Set<String> imports)
Returns a type that corresponds to the specified string using the specified import context.

Parameters:
typeName - the string to be parsed
imports - the fully qualified class names to use when an unqualified class name is encountered
Returns:
the type
Throws:
IllegalArgumentException - if the import context contains duplicate entries for an unqualified class name

JType 0.1.1-redhat-2

Copyright © 2008-2012 JBoss by Red Hat. All Rights Reserved.