org.apache.tools.ant.taskdefs.optional.sitraka.bytecode

Class Utils

public class Utils extends Object

Utilities mostly to manipulate methods and access flags.
Field Summary
static shortACC_ABSTRACT
abstract access flag
static shortACC_FINAL
final access flag
static shortACC_INTERFACE
interface access flag
static shortACC_NATIVE
native access flag
static shortACC_PRIVATE
private access flag
static shortACC_PROTECTED
protected access flag
static shortACC_PUBLIC
public access flag
static shortACC_STATIC
static access flag
static shortACC_STRICT
strict access flag
static shortACC_SUPER
super access flag
static shortACC_SYNCHRONIZED
synchronized access flag
static shortACC_TRANSIENT
transient access flag
static shortACC_VOLATILE
volatile access flag
Method Summary
static intdescriptor2java(String descriptor, int i, StringBuffer sb)
Parse a single descriptor symbol and returns it java equivalent.
static StringgetClassAccess(int access_flags)
return the class access flag as java modifiers
static StringgetFieldAccess(int access_flags)
return the field access flag as java modifiers
static StringgetMethodAccess(int access_flags)
return the method access flag as java modifiers
static String[]getMethodParams(String descriptor)
parse all parameters from a descritor into fields of java name.
static StringgetMethodReturnType(String descriptor)
return the object type of a return type.
static StringgetUTF8Value(ConstantPool pool, int index)
return an UTF8 value from the pool located a a specific index.
static booleanisAbstract(int access_flags)
check for abstract access
static booleanisClass(int access_flags)
check for class access
static booleanisFinal(int access_flags)
chck for final flag
static booleanisInterface(int access_flags)
check for interface access
static booleanisNative(int access_flags)
check for native access
static booleanisPrivate(int access_flags)
check for private access
static booleanisProtected(int access_flags)
check for protected flag
static booleanisPublic(int access_flags)
check for public access
static booleanisStatic(int access_flags)
check for a static access
static booleanisStrict(int access_flags)
check for strict access
static booleanisSuper(int access_flags)
check for super flag
static booleanisSynchronized(int access_flags)
check for synchronized flag
static booleanisTransient(int access_flags)
check for transient flag
static booleanisVolatile(int access_flags)
check for volatile flag

Field Detail

ACC_ABSTRACT

public static final short ACC_ABSTRACT
abstract access flag

ACC_FINAL

public static final short ACC_FINAL
final access flag

ACC_INTERFACE

public static final short ACC_INTERFACE
interface access flag

ACC_NATIVE

public static final short ACC_NATIVE
native access flag

ACC_PRIVATE

public static final short ACC_PRIVATE
private access flag

ACC_PROTECTED

public static final short ACC_PROTECTED
protected access flag

ACC_PUBLIC

public static final short ACC_PUBLIC
public access flag

ACC_STATIC

public static final short ACC_STATIC
static access flag

ACC_STRICT

public static final short ACC_STRICT
strict access flag

ACC_SUPER

public static final short ACC_SUPER
super access flag

ACC_SYNCHRONIZED

public static final short ACC_SYNCHRONIZED
synchronized access flag

ACC_TRANSIENT

public static final short ACC_TRANSIENT
transient access flag

ACC_VOLATILE

public static final short ACC_VOLATILE
volatile access flag

Method Detail

descriptor2java

public static int descriptor2java(String descriptor, int i, StringBuffer sb)
Parse a single descriptor symbol and returns it java equivalent.

Parameters: descriptor the descriptor symbol. i the index to look at the symbol in the descriptor string sb the stringbuffer to return the java equivalent of the symbol

Returns: the index after the descriptor symbol

getClassAccess

public static String getClassAccess(int access_flags)
return the class access flag as java modifiers

Parameters: access_flags access flags

Returns: the access flags as modifier strings

getFieldAccess

public static String getFieldAccess(int access_flags)
return the field access flag as java modifiers

Parameters: access_flags access flags

Returns: the access flags as modifier strings

getMethodAccess

public static String getMethodAccess(int access_flags)
return the method access flag as java modifiers

Parameters: access_flags access flags

Returns: the access flags as modifier strings

getMethodParams

public static String[] getMethodParams(String descriptor)
parse all parameters from a descritor into fields of java name.

Parameters: descriptor of a method.

Returns: the parameter list of a given method descriptor. Each string represent a java object with its fully qualified classname or the primitive name such as int, long, ...

getMethodReturnType

public static String getMethodReturnType(String descriptor)
return the object type of a return type.

Parameters: descriptor

Returns: get the return type objet of a given descriptor

getUTF8Value

public static String getUTF8Value(ConstantPool pool, int index)
return an UTF8 value from the pool located a a specific index.

Parameters: pool the constant pool to look at index index of the UTF8 value in the constant pool

Returns: the value of the string if it exists

Throws: ClassCastException if the index is not an UTF8 constant.

isAbstract

public static boolean isAbstract(int access_flags)
check for abstract access

Parameters: access_flags access flags

isClass

public static boolean isClass(int access_flags)
check for class access

Parameters: access_flags access flags

isFinal

public static boolean isFinal(int access_flags)
chck for final flag

Parameters: access_flags access flags

isInterface

public static boolean isInterface(int access_flags)
check for interface access

Parameters: access_flags access flags

isNative

public static boolean isNative(int access_flags)
check for native access

Parameters: access_flags access flags

isPrivate

public static boolean isPrivate(int access_flags)
check for private access

Parameters: access_flags access flags

isProtected

public static boolean isProtected(int access_flags)
check for protected flag

Parameters: access_flags access flags

isPublic

public static boolean isPublic(int access_flags)
check for public access

Parameters: access_flags access flags

isStatic

public static boolean isStatic(int access_flags)
check for a static access

Parameters: access_flags access flags

isStrict

public static boolean isStrict(int access_flags)
check for strict access

Parameters: access_flags access flags

isSuper

public static boolean isSuper(int access_flags)
check for super flag

Parameters: access_flags access flag

isSynchronized

public static boolean isSynchronized(int access_flags)
check for synchronized flag

Parameters: access_flags access flags

isTransient

public static boolean isTransient(int access_flags)
check for transient flag

Parameters: access_flags access flags

isVolatile

public static boolean isVolatile(int access_flags)
check for volatile flag

Parameters: access_flags access flags

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.