Sun SPOT API
Green Release  


com.sun.squawk
Class Modifier

java.lang.Object
  extended by com.sun.squawk.Modifier

public final class Modifier
extends Object

The Modifier class provides constants to decode class and member access modifiers. The sets of modifiers are represented as integers with distinct bit positions representing different modifiers. The values for the constants representing the modifiers are taken from The JavaTM Virtual Machine Specification, Second edition tables 4.1, 4.4, 4.5, and 4.7.

The modifiers in the Squawk system augment those defined in the JVM specification to include flags denoting Squawk specific properties of classes and members.

Author:
Nakul Saraiya, Kenneth Russell

Field Summary
static int ABSTRACT
          The int value representing the abstract modifier.
static int ARRAY
          The int value denoting that a class represents a Java array.
static int COMPLETE_RUNTIME_STATICS
          The int value denoting that a class has at least one static variable that requires initialization from a ConstantValue attribute and/or must have a runtime representation because it is accessed via a getstatic or putstatic instruction.
static int CONSTANT
          The int value denoting that a field has a ConstantValue.
static int CONSTRUCTOR
          The int value denoting that a method is a constructor.
static int DOUBLEWORD
          The int value denoting that a class represents a double word type (i.e.
static int FINAL
          The int value representing the final modifier.
static int GLOBAL_STATICS
          The int value denoting that the static fields in a class are VM global.
static int HAS_PRAGMAS
          The int value denoting that a method has one or more pragmas applied to it.
static int HASFINALIZER
          The int value denoting that a class overrides the Object.finalize() method.
static int INTERFACE
          The int value representing the interface modifier.
static int MUSTCLINIT
          The int value denoting that a class must have its class initializer executed before it is used.
static int NATIVE
          The int value representing the native modifier.
static int PRIMITIVE
          The int value denoting that a class represents a primitive type.
static int PRIVATE
          The int value representing the private modifier.
static int PROTECTED
          The int value representing the protected modifier.
static int PUBLIC
          The int value representing the public modifier.
static int SOURCE_SYNTHETIC
          The int value denoting that a class, method or field does not appear in the source code.
static int SQUAWKARRAY
          The int value denoting that a class whose instances are represented in the array object format.
static int SQUAWKPRIMITIVE
          The int value denoting that a class represents a special class that the Squawk translator and compiler convert into a primitive type.
static int STATIC
          The int value representing the static modifier.
static int STRICT
          The int value representing the strictfp modifier.
static int SUPER
          The int value denoting that superclass methods should be treated specially when invoked by the invokespecial instruction.
static int SYNCHRONIZED
          The int value representing the synchronized modifier.
static int SYNTHETIC
          The int value denoting that a class that does not have a class file representation.
static int TRANSIENT
          The int value representing the transient modifier.
static int VOLATILE
          The int value representing the volatile modifier.
 
Constructor Summary
Modifier()
           
 
Method Summary
static int getJVMClassModifiers()
          Gets the mask of modifiers that are defined the JVM specification that pertain to a class.
static int getJVMFieldModifiers()
          Gets the mask of modifiers that are defined the JVM specification that pertain to a field.
static int getJVMMethodModifiers()
          Gets the mask of modifiers that are defined the JVM specification that pertain to a method.
static boolean hasConstant(int mod)
          Return true if the integer argument includes the CONSTANT modifer, false otherwise.
static boolean hasFinalizer(int mod)
          Return true if the integer argument includes the HASFINALIZER modifer, false otherwise.
static boolean hasGlobalStatics(int mod)
           
static boolean hasPragmas(int mod)
          Return true if the integer argument includes the HAS_PRAGMAS modifer, false otherwise.
static boolean isAbstract(int mod)
          Return true if the integer argument includes the abstract modifer, false otherwise.
static boolean isArray(int mod)
          Return true if the integer argument includes the ARRAY modifer, false otherwise.
static boolean isConstructor(int mod)
          Return true if the integer argument includes the CONSTRUCTOR modifer, false otherwise.
static boolean isDoubleWord(int mod)
          Return true if the integer argument includes the DOUBLEWORD modifer, false otherwise.
static boolean isFinal(int mod)
          Return true if the integer argument includes the final modifer, false otherwise.
static boolean isInterface(int mod)
          Return true if the integer argument includes the interface modifer, false otherwise.
static boolean isNative(int mod)
          Return true if the integer argument includes the native modifer, false otherwise.
static boolean isPackagePrivate(int mod)
          Return true if the integer argument does not include the public, protected or private modifer, false otherwise.
static boolean isPrimitive(int mod)
          Return true if the integer argument includes the PRIMITIVE modifer, false otherwise.
static boolean isPrivate(int mod)
          Return true if the integer argument includes the private modifer, false otherwise.
static boolean isProtected(int mod)
          Return true if the integer argument includes the protected modifer, false otherwise.
static boolean isPublic(int mod)
          Return true if the integer argument includes the public modifer, false otherwise.
static boolean isSourceSynthetic(int mod)
          Return true if the integer argument includes the SOURCE_SYNTHETIC modifer, false otherwise.
static boolean isSquawkArray(int mod)
          Return true if the integer argument includes the SQUAWKARRAY modifer, false otherwise.
static boolean isSquawkPrimitive(int mod)
          Return true if the integer argument includes the SQUAWKPRIMITIVE modifer, false otherwise.
static boolean isStatic(int mod)
          Return true if the integer argument includes the static modifer, false otherwise.
static boolean isStrict(int mod)
          Return true if the integer argument includes the strictfp modifer, false otherwise.
static boolean isSynchronized(int mod)
          Return true if the integer argument includes the synchronized modifer, false otherwise.
static boolean isSynthetic(int mod)
          Return true if the integer argument includes the SYNTHETIC modifer, false otherwise.
static boolean isTransient(int mod)
          Return true if the integer argument includes the transient modifer, false otherwise.
static boolean isVolatile(int mod)
          Return true if the integer argument includes the volatile modifer, false otherwise.
static boolean mustClinit(int mod)
          Return true if the integer argument includes the MUSTCLINIT modifer, false otherwise.
static String toString(int mod)
          Return a string describing the access modifier flags in the specified modifier.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC

public static final int PUBLIC
The int value representing the public modifier.

See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
The int value representing the private modifier.

See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
The int value representing the protected modifier.

See Also:
Constant Field Values

STATIC

public static final int STATIC
The int value representing the static modifier.

See Also:
Constant Field Values

FINAL

public static final int FINAL
The int value representing the final modifier.

See Also:
Constant Field Values

SYNCHRONIZED

public static final int SYNCHRONIZED
The int value representing the synchronized modifier.

See Also:
Constant Field Values

VOLATILE

public static final int VOLATILE
The int value representing the volatile modifier.

See Also:
Constant Field Values

TRANSIENT

public static final int TRANSIENT
The int value representing the transient modifier.

See Also:
Constant Field Values

NATIVE

public static final int NATIVE
The int value representing the native modifier.

See Also:
Constant Field Values

INTERFACE

public static final int INTERFACE
The int value representing the interface modifier.

See Also:
Constant Field Values

ABSTRACT

public static final int ABSTRACT
The int value representing the abstract modifier.

See Also:
Constant Field Values

STRICT

public static final int STRICT
The int value representing the strictfp modifier.

See Also:
Constant Field Values

CONSTRUCTOR

public static final int CONSTRUCTOR
The int value denoting that a method is a constructor.

See Also:
Constant Field Values

HAS_PRAGMAS

public static final int HAS_PRAGMAS
The int value denoting that a method has one or more pragmas applied to it.

See Also:
Constant Field Values

CONSTANT

public static final int CONSTANT
The int value denoting that a field has a ConstantValue.

See Also:
Constant Field Values

SOURCE_SYNTHETIC

public static final int SOURCE_SYNTHETIC
The int value denoting that a class, method or field does not appear in the source code.

See Also:
Constant Field Values

SUPER

public static final int SUPER
The int value denoting that superclass methods should be treated specially when invoked by the invokespecial instruction.

See Also:
Constant Field Values

MUSTCLINIT

public static final int MUSTCLINIT
The int value denoting that a class must have its class initializer executed before it is used.

See Also:
Constant Field Values

HASFINALIZER

public static final int HASFINALIZER
The int value denoting that a class overrides the Object.finalize() method.

See Also:
Constant Field Values

PRIMITIVE

public static final int PRIMITIVE
The int value denoting that a class represents a primitive type.

See Also:
Constant Field Values

SYNTHETIC

public static final int SYNTHETIC
The int value denoting that a class that does not have a class file representation.

See Also:
Constant Field Values

DOUBLEWORD

public static final int DOUBLEWORD
The int value denoting that a class represents a double word type (i.e. long or double).

See Also:
Constant Field Values

ARRAY

public static final int ARRAY
The int value denoting that a class represents a Java array.

See Also:
Constant Field Values

SQUAWKARRAY

public static final int SQUAWKARRAY
The int value denoting that a class whose instances are represented in the array object format.

See Also:
Constant Field Values

SQUAWKPRIMITIVE

public static final int SQUAWKPRIMITIVE
The int value denoting that a class represents a special class that the Squawk translator and compiler convert into a primitive type. Values of these types are not compatible with any other types and requires explicit conversions.

For efficiency and to avoid meta-circularity, the Squawk primitive variables are intercepted by the translator and converted into the base type (int or long) so no real object is created at run-time.

There are a number of restrictions that must be observed when programming with these classes. Some of these constraints are imposed to keep the job of the translator simple. All of these constraints are currently enforced by the translator. The constraints are:

See Also:
Constant Field Values

COMPLETE_RUNTIME_STATICS

public static final int COMPLETE_RUNTIME_STATICS
The int value denoting that a class has at least one static variable that requires initialization from a ConstantValue attribute and/or must have a runtime representation because it is accessed via a getstatic or putstatic instruction. This occurs (at least) in the following TCK tests: javasoft.sqe.tests.vm.classfmt.atr.atrcvl004.atrcvl00401m1.atrcvl00401m1_wrapper javasoft.sqe.tests.vm.classfmt.cpl.cplint001.cplint00101m1.cplint00101m1_wrapper javasoft.sqe.tests.vm.classfmt.cpl.cpllng001.cpllng00101m1.cpllng00101m1_wrapper javasoft.sqe.tests.vm.overview.SpecInitMethods.SpecInitMethods004.SpecInitMethods00405m1.SpecInitMethods004_wrapper

See Also:
Constant Field Values

GLOBAL_STATICS

public static final int GLOBAL_STATICS
The int value denoting that the static fields in a class are VM global.

See Also:
Constant Field Values
Constructor Detail

Modifier

public Modifier()
Method Detail

isPublic

public static boolean isPublic(int mod)
Return true if the integer argument includes the public modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the public modifier; false otherwise.

isPrivate

public static boolean isPrivate(int mod)
Return true if the integer argument includes the private modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the private modifier; false otherwise.

isProtected

public static boolean isProtected(int mod)
Return true if the integer argument includes the protected modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the protected modifier; false otherwise.

isPackagePrivate

public static boolean isPackagePrivate(int mod)
Return true if the integer argument does not include the public, protected or private modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod does not include the public, protected or private modifier; false otherwise.

isStatic

public static boolean isStatic(int mod)
Return true if the integer argument includes the static modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the static modifier; false otherwise.

isFinal

public static boolean isFinal(int mod)
Return true if the integer argument includes the final modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the final modifier; false otherwise.

isSynchronized

public static boolean isSynchronized(int mod)
Return true if the integer argument includes the synchronized modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the synchronized modifier; false otherwise.

isVolatile

public static boolean isVolatile(int mod)
Return true if the integer argument includes the volatile modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the volatile modifier; false otherwise.

isTransient

public static boolean isTransient(int mod)
Return true if the integer argument includes the transient modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the transient modifier; false otherwise.

isNative

public static boolean isNative(int mod)
Return true if the integer argument includes the native modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the native modifier; false otherwise.

isInterface

public static boolean isInterface(int mod)
Return true if the integer argument includes the interface modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the interface modifier; false otherwise.

isAbstract

public static boolean isAbstract(int mod)
Return true if the integer argument includes the abstract modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the abstract modifier; false otherwise.

isStrict

public static boolean isStrict(int mod)
Return true if the integer argument includes the strictfp modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the strictfp modifier; false otherwise.

toString

public static String toString(int mod)
Return a string describing the access modifier flags in the specified modifier. For example:
    public final synchronized strictfp
 
The modifier names are returned in an order consistent with the suggested modifier orderings given in The Java Language Specification, Second Edition sections §8.1.1, §8.3.1, §8.4.3, §8.8.3, and §9.1.1. The full modifier ordering used by this method is:
public protected private abstract static final transient volatile synchronized native strictfp interface
The interface modifier discussed in this class is not a true modifier in the Java language and it appears after all other modifiers listed by this method. This method may return a string of modifiers that are not valid modifiers of a Java entity; in other words, no checking is done on the possible validity of the combination of modifiers represented by the input.

Parameters:
mod - a set of modifers
Returns:
a string representation of the set of modifers represented by mod

mustClinit

public static boolean mustClinit(int mod)
Return true if the integer argument includes the MUSTCLINIT modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the MUSTCLINIT modifier; false otherwise.

hasFinalizer

public static boolean hasFinalizer(int mod)
Return true if the integer argument includes the HASFINALIZER modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the HASFINALIZER modifier; false otherwise.

isPrimitive

public static boolean isPrimitive(int mod)
Return true if the integer argument includes the PRIMITIVE modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the PRIMITIVE modifier; false otherwise.

isSynthetic

public static boolean isSynthetic(int mod)
Return true if the integer argument includes the SYNTHETIC modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the SYNTHETIC modifier; false otherwise.

isSourceSynthetic

public static boolean isSourceSynthetic(int mod)
Return true if the integer argument includes the SOURCE_SYNTHETIC modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the SOURCE_SYNTHETIC modifier; false otherwise.

isDoubleWord

public static boolean isDoubleWord(int mod)
Return true if the integer argument includes the DOUBLEWORD modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the DOUBLEWORD modifier; false otherwise.

isArray

public static boolean isArray(int mod)
Return true if the integer argument includes the ARRAY modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the ARRAY modifier; false otherwise.

isSquawkArray

public static boolean isSquawkArray(int mod)
Return true if the integer argument includes the SQUAWKARRAY modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the SQUAWKARRAY modifier; false otherwise.

isSquawkPrimitive

public static boolean isSquawkPrimitive(int mod)
Return true if the integer argument includes the SQUAWKPRIMITIVE modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the SQUAWKPRIMITIVE modifier; false otherwise.

isConstructor

public static boolean isConstructor(int mod)
Return true if the integer argument includes the CONSTRUCTOR modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the CONSTRUCTOR modifier; false otherwise.

hasConstant

public static boolean hasConstant(int mod)
Return true if the integer argument includes the CONSTANT modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the CONSTANT modifier; false otherwise.

hasPragmas

public static boolean hasPragmas(int mod)
Return true if the integer argument includes the HAS_PRAGMAS modifer, false otherwise.

Parameters:
mod - a set of modifers
Returns:
true if mod includes the HAS_PRAGMAS modifier; false otherwise.

hasGlobalStatics

public static boolean hasGlobalStatics(int mod)

getJVMClassModifiers

public static int getJVMClassModifiers()
Gets the mask of modifiers that are defined the JVM specification that pertain to a class.

Returns:
the mask of values defined in table 4.1 in the JVM specification

getJVMMethodModifiers

public static int getJVMMethodModifiers()
Gets the mask of modifiers that are defined the JVM specification that pertain to a method.

Returns:
the mask of values defined in table 4.5 in the JVM specification

getJVMFieldModifiers

public static int getJVMFieldModifiers()
Gets the mask of modifiers that are defined the JVM specification that pertain to a field.

Returns:
the mask of values defined in table 4.4 in the JVM specification

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.