java.lang.reflect
Class Modifier

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.reflect.Modifier

public class Modifier
extends Object sample code for java.lang.Object definition code for java.lang.Object

The Modifier class provides static methods and 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.

See Also:
Class.getModifiers() sample code for java.lang.Class.getModifiers() definition code for java.lang.Class.getModifiers() , Member.getModifiers() sample code for java.lang.reflect.Member.getModifiers() definition code for java.lang.reflect.Member.getModifiers()

Field Summary
static int ABSTRACT sample code for java.lang.reflect.Modifier.ABSTRACT definition code for java.lang.reflect.Modifier.ABSTRACT
          The int value representing the abstract modifier.
static int FINAL sample code for java.lang.reflect.Modifier.FINAL definition code for java.lang.reflect.Modifier.FINAL
          The int value representing the final modifier.
static int INTERFACE sample code for java.lang.reflect.Modifier.INTERFACE definition code for java.lang.reflect.Modifier.INTERFACE
          The int value representing the interface modifier.
static int NATIVE sample code for java.lang.reflect.Modifier.NATIVE definition code for java.lang.reflect.Modifier.NATIVE
          The int value representing the native modifier.
static int PRIVATE sample code for java.lang.reflect.Modifier.PRIVATE definition code for java.lang.reflect.Modifier.PRIVATE
          The int value representing the private modifier.
static int PROTECTED sample code for java.lang.reflect.Modifier.PROTECTED definition code for java.lang.reflect.Modifier.PROTECTED
          The int value representing the protected modifier.
static int PUBLIC sample code for java.lang.reflect.Modifier.PUBLIC definition code for java.lang.reflect.Modifier.PUBLIC
          The int value representing the public modifier.
static int STATIC sample code for java.lang.reflect.Modifier.STATIC definition code for java.lang.reflect.Modifier.STATIC
          The int value representing the static modifier.
static int STRICT sample code for java.lang.reflect.Modifier.STRICT definition code for java.lang.reflect.Modifier.STRICT
          The int value representing the strictfp modifier.
static int SYNCHRONIZED sample code for java.lang.reflect.Modifier.SYNCHRONIZED definition code for java.lang.reflect.Modifier.SYNCHRONIZED
          The int value representing the synchronized modifier.
static int TRANSIENT sample code for java.lang.reflect.Modifier.TRANSIENT definition code for java.lang.reflect.Modifier.TRANSIENT
          The int value representing the transient modifier.
static int VOLATILE sample code for java.lang.reflect.Modifier.VOLATILE definition code for java.lang.reflect.Modifier.VOLATILE
          The int value representing the volatile modifier.
 
Constructor Summary
Modifier sample code for java.lang.reflect.Modifier.Modifier() definition code for java.lang.reflect.Modifier.Modifier() ()
           
 
Method Summary
static boolean isAbstract sample code for java.lang.reflect.Modifier.isAbstract(int) definition code for java.lang.reflect.Modifier.isAbstract(int) (int mod)
          Return true if the integer argument includes the abstract modifier, false otherwise.
static boolean isFinal sample code for java.lang.reflect.Modifier.isFinal(int) definition code for java.lang.reflect.Modifier.isFinal(int) (int mod)
          Return true if the integer argument includes the final modifier, false otherwise.
static boolean isInterface sample code for java.lang.reflect.Modifier.isInterface(int) definition code for java.lang.reflect.Modifier.isInterface(int) (int mod)
          Return true if the integer argument includes the interface modifier, false otherwise.
static boolean isNative sample code for java.lang.reflect.Modifier.isNative(int) definition code for java.lang.reflect.Modifier.isNative(int) (int mod)
          Return true if the integer argument includes the native modifier, false otherwise.
static boolean isPrivate sample code for java.lang.reflect.Modifier.isPrivate(int) definition code for java.lang.reflect.Modifier.isPrivate(int) (int mod)
          Return true if the integer argument includes the private modifier, false otherwise.
static boolean isProtected sample code for java.lang.reflect.Modifier.isProtected(int) definition code for java.lang.reflect.Modifier.isProtected(int) (int mod)
          Return true if the integer argument includes the protected modifier, false otherwise.
static boolean isPublic sample code for java.lang.reflect.Modifier.isPublic(int) definition code for java.lang.reflect.Modifier.isPublic(int) (int mod)
          Return true if the integer argument includes the public modifier, false otherwise.
static boolean isStatic sample code for java.lang.reflect.Modifier.isStatic(int) definition code for java.lang.reflect.Modifier.isStatic(int) (int mod)
          Return true if the integer argument includes the static modifier, false otherwise.
static boolean isStrict sample code for java.lang.reflect.Modifier.isStrict(int) definition code for java.lang.reflect.Modifier.isStrict(int) (int mod)
          Return true if the integer argument includes the strictfp modifier, false otherwise.
static boolean isSynchronized sample code for java.lang.reflect.Modifier.isSynchronized(int) definition code for java.lang.reflect.Modifier.isSynchronized(int) (int mod)
          Return true if the integer argument includes the synchronized modifier, false otherwise.
static boolean isTransient sample code for java.lang.reflect.Modifier.isTransient(int) definition code for java.lang.reflect.Modifier.isTransient(int) (int mod)
          Return true if the integer argument includes the transient modifier, false otherwise.
static boolean isVolatile sample code for java.lang.reflect.Modifier.isVolatile(int) definition code for java.lang.reflect.Modifier.isVolatile(int) (int mod)
          Return true if the integer argument includes the volatile modifier, false otherwise.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.lang.reflect.Modifier.toString(int) definition code for java.lang.reflect.Modifier.toString(int) (int mod)
          Return a string describing the access modifier flags in the specified modifier.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

PUBLIC sample code for java.lang.reflect.Modifier.PUBLIC

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

See Also:
Constant Field Values

PRIVATE sample code for java.lang.reflect.Modifier.PRIVATE

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

See Also:
Constant Field Values

PROTECTED sample code for java.lang.reflect.Modifier.PROTECTED

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

See Also:
Constant Field Values

STATIC sample code for java.lang.reflect.Modifier.STATIC

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

See Also:
Constant Field Values

FINAL sample code for java.lang.reflect.Modifier.FINAL

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

See Also:
Constant Field Values

SYNCHRONIZED sample code for java.lang.reflect.Modifier.SYNCHRONIZED

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

See Also:
Constant Field Values

VOLATILE sample code for java.lang.reflect.Modifier.VOLATILE

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

See Also:
Constant Field Values

TRANSIENT sample code for java.lang.reflect.Modifier.TRANSIENT

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

See Also:
Constant Field Values

NATIVE sample code for java.lang.reflect.Modifier.NATIVE

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

See Also:
Constant Field Values

INTERFACE sample code for java.lang.reflect.Modifier.INTERFACE

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

See Also:
Constant Field Values

ABSTRACT sample code for java.lang.reflect.Modifier.ABSTRACT

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

See Also:
Constant Field Values

STRICT sample code for java.lang.reflect.Modifier.STRICT

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

See Also:
Constant Field Values
Constructor Detail

Modifier sample code for java.lang.reflect.Modifier() definition code for java.lang.reflect.Modifier()

public Modifier()
Method Detail

isPublic sample code for java.lang.reflect.Modifier.isPublic(int) definition code for java.lang.reflect.Modifier.isPublic(int)

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

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

isPrivate sample code for java.lang.reflect.Modifier.isPrivate(int) definition code for java.lang.reflect.Modifier.isPrivate(int)

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

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

isProtected sample code for java.lang.reflect.Modifier.isProtected(int) definition code for java.lang.reflect.Modifier.isProtected(int)

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

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

isStatic sample code for java.lang.reflect.Modifier.isStatic(int) definition code for java.lang.reflect.Modifier.isStatic(int)

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

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

isFinal sample code for java.lang.reflect.Modifier.isFinal(int) definition code for java.lang.reflect.Modifier.isFinal(int)

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

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

isSynchronized sample code for java.lang.reflect.Modifier.isSynchronized(int) definition code for java.lang.reflect.Modifier.isSynchronized(int)

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

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

isVolatile sample code for java.lang.reflect.Modifier.isVolatile(int) definition code for java.lang.reflect.Modifier.isVolatile(int)

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

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

isTransient sample code for java.lang.reflect.Modifier.isTransient(int) definition code for java.lang.reflect.Modifier.isTransient(int)

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

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

isNative sample code for java.lang.reflect.Modifier.isNative(int) definition code for java.lang.reflect.Modifier.isNative(int)

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

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

isInterface sample code for java.lang.reflect.Modifier.isInterface(int) definition code for java.lang.reflect.Modifier.isInterface(int)

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

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

isAbstract sample code for java.lang.reflect.Modifier.isAbstract(int) definition code for java.lang.reflect.Modifier.isAbstract(int)

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

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

isStrict sample code for java.lang.reflect.Modifier.isStrict(int) definition code for java.lang.reflect.Modifier.isStrict(int)

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

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

toString sample code for java.lang.reflect.Modifier.toString(int) definition code for java.lang.reflect.Modifier.toString(int)

public static String sample code for java.lang.String definition code for java.lang.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 modifiers
Returns:
a string representation of the set of modifiers represented by mod