de.hpi.fgis.dude.util
Class BoundType

java.lang.Object
  extended by de.hpi.fgis.dude.util.BoundType

public class BoundType
extends Object

Represents an rectified, generic type, which is only equal to another BoundType iff all bounds are exactly the same.

Author:
Arvid.Heise

Constructor Summary
BoundType(Class<?> type)
          Initializes a BoundType around the given raw type.
BoundType(ParameterizedType type)
          Initializes a BoundType around the given parameterized type.
 
Method Summary
static BoundType[] arrayOf(Class<?>... rawTypes)
          Wraps an array of Class to an array of BoundTypes without parameters.
 boolean equals(Object obj)
           
 ParameterizedType getParameterizedType()
          Returns the wrapped parameterized type or null if this BoundType was not created around a ParameterizedType.
 BoundType[] getParameters()
          Returns the bound types or an empty array if none exists.
 Class<?> getType()
          Returns the raw type.
 int hashCode()
           
static BoundType of(Class<?> rawType, BoundType... parameters)
          Creates a BoundType around the given raw type with additional type parameters.
static BoundType of(Class<?> rawType, Class<?> subType1, Class<?>... otherTypes)
          Creates a BoundType around the given raw type with additional type parameters.
static BoundType of(ParameterizedType type)
          Creates a BoundType for the given ParameterizedType.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundType

public BoundType(Class<?> type)
Initializes a BoundType around the given raw type.

Parameters:
type - the type to wrap

BoundType

public BoundType(ParameterizedType type)
Initializes a BoundType around the given parameterized type. Recursively determines the static bounds of all superclasses.

Parameters:
type - the type to wrap
Method Detail

arrayOf

public static BoundType[] arrayOf(Class<?>... rawTypes)
Wraps an array of Class to an array of BoundTypes without parameters.

Parameters:
rawTypes - the classes to wrap
Returns:
an array containing a BoundType for each raw type

of

public static BoundType of(Class<?> rawType,
                           BoundType... parameters)
Creates a BoundType around the given raw type with additional type parameters.

Parameters:
rawType - the class to wrap
parameters - the type parameters
Returns:
a BoundType representing the raw type and its parameters

of

public static BoundType of(Class<?> rawType,
                           Class<?> subType1,
                           Class<?>... otherTypes)
Creates a BoundType around the given raw type with additional type parameters.

Parameters:
rawType - the classes to wrap
subType1 - the first type parameter
otherTypes - additional type parameters
Returns:
a BoundType representing the raw type and its parameters

of

public static BoundType of(ParameterizedType type)
Creates a BoundType for the given ParameterizedType.

Parameters:
type - the type to wrap
Returns:
a recursively resolved type

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getParameterizedType

public ParameterizedType getParameterizedType()
Returns the wrapped parameterized type or null if this BoundType was not created around a ParameterizedType.

Returns:
the wrapped parameterized type or null

getParameters

public BoundType[] getParameters()
Returns the bound types or an empty array if none exists.

Returns:
the bound types

getType

public Class<?> getType()
Returns the raw type.

Returns:
the raw type

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.