net.sourceforge.retroweaver.runtime.java.lang
Class Class_

java.lang.Object
  extended by net.sourceforge.retroweaver.runtime.java.lang.Class_

public final class Class_
extends java.lang.Object

Replacements for methods added to java.lang.Class in Java 1.5.


Method Summary
static java.lang.Class asSubclass(java.lang.Class<?> c, java.lang.Class<?> superclass)
          Replacement for Class.asSubclass(Class).
static java.lang.Object cast(java.lang.Class c, java.lang.Object object)
          Replacement for Class.cast(Object).
static
<T extends Annotation>
T
getAnnotation(java.lang.Class c, java.lang.Class<T> annotationType)
          Returns this element's annotation for the specified type if such an annotation is present, else null.
static Annotation[] getAnnotations(java.lang.Class c)
          Returns all annotations present on this element.
static java.lang.String getCanonicalName(java.lang.Class class_)
           
static Annotation[] getDeclaredAnnotations(java.lang.Class c)
          Returns all annotations that are directly present on this element.
static java.lang.Class<?> getEnclosingClass(java.lang.Class class_)
           
static java.lang.reflect.Constructor<?> getEnclosingConstructor(java.lang.Class class_)
           
static java.lang.reflect.Method getEnclosingMethod(java.lang.Class class_)
           
static
<T> T[]
getEnumConstants(java.lang.Class<T> class_)
          Replacement for Class.getEnumConstants().
static Type[] getGenericInterfaces(java.lang.Class class_)
           
static Type getGenericSuperclass(java.lang.Class class_)
           
static java.lang.String getSimpleName(java.lang.Class class_)
          replacement for Class.getSimpleName()
static TypeVariable[] getTypeParameters(java.lang.Class class_)
           
static boolean isAnnotation(java.lang.Class c)
           
static boolean isAnnotationPresent(java.lang.Class c, java.lang.Class<? extends Annotation> annotationType)
          Returns true if an annotation for the specified type is present on this element, else false.
static boolean isAnonymousClass(java.lang.Class class_)
          replacement for Class.isAnonymousClass()
static
<T> boolean
isEnum(java.lang.Class<T> class_)
          Replacement for Class.isEnum().
static boolean isLocalClass(java.lang.Class class_)
           
static boolean isMemberClass(java.lang.Class class_)
           
static boolean isSynthetic(java.lang.Class class_)
          replacement for Class.isSynthetic()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isAnnotation

public static boolean isAnnotation(java.lang.Class c)

getAnnotation

public static <T extends Annotation> T getAnnotation(java.lang.Class c,
                                                     java.lang.Class<T> annotationType)
Returns this element's annotation for the specified type if such an annotation is present, else null.


getAnnotations

public static Annotation[] getAnnotations(java.lang.Class c)
Returns all annotations present on this element.


getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(java.lang.Class c)
Returns all annotations that are directly present on this element.


isAnnotationPresent

public static boolean isAnnotationPresent(java.lang.Class c,
                                          java.lang.Class<? extends Annotation> annotationType)
Returns true if an annotation for the specified type is present on this element, else false.


asSubclass

public static java.lang.Class asSubclass(java.lang.Class<?> c,
                                         java.lang.Class<?> superclass)
Replacement for Class.asSubclass(Class).

Parameters:
c - a Class
superclass - another Class which must be a superclass of c
Returns:
c
Throws:
java.lang.ClassCastException - if c is

cast

public static java.lang.Object cast(java.lang.Class c,
                                    java.lang.Object object)
Replacement for Class.cast(Object). Throws a ClassCastException if obj is not an instance of class c, or a subtype of c.

Parameters:
c - Class we want to cast obj to
object - object we want to cast
Returns:
The object, or null if the object is null.
Throws:
java.lang.ClassCastException - if obj is not null or an instance of c

isEnum

public static <T> boolean isEnum(java.lang.Class<T> class_)
Replacement for Class.isEnum().

Parameters:
class_ - class we want to test.
Returns:
true if the class was declared as an Enum.

getEnumConstants

public static <T> T[] getEnumConstants(java.lang.Class<T> class_)
Replacement for Class.getEnumConstants().

Parameters:
class_ - class we want to get Enum constants for.
Returns:
The elements of this enum class or null if this does not represent an enum type.

isAnonymousClass

public static boolean isAnonymousClass(java.lang.Class class_)
replacement for Class.isAnonymousClass()


getSimpleName

public static java.lang.String getSimpleName(java.lang.Class class_)
replacement for Class.getSimpleName()


isSynthetic

public static boolean isSynthetic(java.lang.Class class_)
replacement for Class.isSynthetic()


getTypeParameters

public static TypeVariable[] getTypeParameters(java.lang.Class class_)
                                        throws GenericSignatureFormatError
Throws:
GenericSignatureFormatError

getGenericSuperclass

public static Type getGenericSuperclass(java.lang.Class class_)
                                 throws GenericSignatureFormatError,
                                        TypeNotPresentException,
                                        MalformedParameterizedTypeException
Throws:
GenericSignatureFormatError
TypeNotPresentException
MalformedParameterizedTypeException

getGenericInterfaces

public static Type[] getGenericInterfaces(java.lang.Class class_)
                                   throws GenericSignatureFormatError,
                                          TypeNotPresentException,
                                          MalformedParameterizedTypeException
Throws:
GenericSignatureFormatError
TypeNotPresentException
MalformedParameterizedTypeException

getEnclosingMethod

public static java.lang.reflect.Method getEnclosingMethod(java.lang.Class class_)

getEnclosingConstructor

public static java.lang.reflect.Constructor<?> getEnclosingConstructor(java.lang.Class class_)

getEnclosingClass

public static java.lang.Class<?> getEnclosingClass(java.lang.Class class_)

getCanonicalName

public static java.lang.String getCanonicalName(java.lang.Class class_)

isLocalClass

public static boolean isLocalClass(java.lang.Class class_)

isMemberClass

public static boolean isMemberClass(java.lang.Class class_)