koala.dynamicjava.util
Class TigerUtilities

java.lang.Object
  extended by koala.dynamicjava.util.TigerUtilities

public class TigerUtilities
extends Object

Common utilities of DynamicJava for implementing features of 1.5.


Field Summary
static int ANNOTATION
           
static int BRIDGE
           
static int ENUM
           
static int SYNTHETIC
           
static int VARARGS
           
static float VERSION
          The version of the java runtime environment that is in use.
 
Constructor Summary
TigerUtilities()
           
 
Method Summary
static void assertTigerEnabled(String msg)
          To be called before a feature of 1.5 is used.
static boolean boxesTo(Class<?> prim, Class<?> ref)
          Returns true iff the given primitive class can be boxed to the given reference class.
static Class<?> correspondingBoxingType(Class<?> primType)
          Returns the reference type that corresponds to the given primitive type.
static Class<?> correspondingPrimType(Class<?> refType)
          Returns the primitive type that corresponds to the given reference type.
static boolean isBoxingType(Class<?> c)
          Returns if the given class is a reference type
static boolean isBridge(Method m)
           
static boolean isEnum(Class<?> c)
           
static boolean isEnumConstant(Field f)
           
static boolean isIntegralType(Class<?> c)
          Returns true iff the given class is an integral type This includes both primitive and boxing integral types.

Allowed primitives: byte, char, short, int, long Allowed Refrence: Byte, Character, Short, Integer, Long
static boolean isTigerEnabled()
          Accessor method for _tigerEnabled.
static boolean isVarArgs(Constructor<?> c)
           
static boolean isVarArgs(Method m)
           
static void resetVersion()
          Resets _tigerEnabled based upon the version of the runtime environment that is being used.
static void setTigerEnabled(boolean enabled)
          Allows the features in 1.5 to be enabled or disabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRIDGE

public static final int BRIDGE
See Also:
Constant Field Values

VARARGS

public static final int VARARGS
See Also:
Constant Field Values

SYNTHETIC

public static final int SYNTHETIC
See Also:
Constant Field Values

ANNOTATION

public static final int ANNOTATION
See Also:
Constant Field Values

ENUM

public static final int ENUM
See Also:
Constant Field Values

VERSION

public static final float VERSION
The version of the java runtime environment that is in use.

Constructor Detail

TigerUtilities

public TigerUtilities()
Method Detail

resetVersion

public static void resetVersion()
Resets _tigerEnabled based upon the version of the runtime environment that is being used.


isTigerEnabled

public static boolean isTigerEnabled()
Accessor method for _tigerEnabled. Returns true if the features in 1.5 are enabled currently.

Returns:
boolean - true if 1.5 features are enabled

setTigerEnabled

public static void setTigerEnabled(boolean enabled)
Allows the features in 1.5 to be enabled or disabled. Used only in test cases.

Parameters:
enabled - - a boolean that specifies whether or not Tiger features are to be enabled

assertTigerEnabled

public static void assertTigerEnabled(String msg)
To be called before a feature of 1.5 is used. Asserts that Tiger features are enabled.

Parameters:
msg - The error message if 1.5 is not enabled

isVarArgs

public static boolean isVarArgs(Method m)
Returns:
@{code true} iff m has the vararg modifier set.

isVarArgs

public static boolean isVarArgs(Constructor<?> c)
Returns:
@{code true} iff c has the vararg modifier set.

isBridge

public static boolean isBridge(Method m)
Returns:
@{code true} iff m has the bridge modifier set.

isEnum

public static boolean isEnum(Class<?> c)
Returns:
@{code true} iff c has the enum modifier set.

isEnumConstant

public static boolean isEnumConstant(Field f)
Returns:
@{code true} iff f has the enum modifier set.

correspondingBoxingType

public static Class<?> correspondingBoxingType(Class<?> primType)
Returns the reference type that corresponds to the given primitive type. If the type given is not primitive, it returns the given type.

Parameters:
primType - the primitive type
Returns:
the corresponding reference type

correspondingPrimType

public static Class<?> correspondingPrimType(Class<?> refType)
Returns the primitive type that corresponds to the given reference type. If the given type is not a boxing type, it returns the given type.

Parameters:
refType - the reference type
Returns:
the corresponding primitive type

isBoxingType

public static boolean isBoxingType(Class<?> c)
Returns if the given class is a reference type

Parameters:
c - the class that may be a reference type
Returns:
boolean that is true if the input class is a boxing type

isIntegralType

public static boolean isIntegralType(Class<?> c)
Returns true iff the given class is an integral type This includes both primitive and boxing integral types.

Allowed primitives: byte, char, short, int, long Allowed Refrence: Byte, Character, Short, Integer, Long

Parameters:
c - The class to check
Returns:
true iff the given class is an integral type

boxesTo

public static boolean boxesTo(Class<?> prim,
                              Class<?> ref)
Returns true iff the given primitive class can be boxed to the given reference class.

Parameters:
prim - - the primitive class being boxed
ref - - the reference class being boxed to
Returns:
true iff the given primitive class can be boxed to the given reference class