Modifier (Java 2 Platform SE 5.0) (original) (raw)
java.lang.reflect
Class Modifier
java.lang.Object
java.lang.reflect.Modifier
public class Modifier
extends 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 Java_TM Virtual Machine Specification, Second edition tables 4.1,4.4,4.5, and 4.7.
See Also:
Class.getModifiers(), Member.getModifiers()
Field Summary | |
---|---|
static int | ABSTRACT The int value representing the abstract modifier. |
static int | FINAL The int value representing the final modifier. |
static int | INTERFACE The int value representing the interface modifier. |
static int | NATIVE The int value representing the native modifier. |
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 | STATIC The int value representing the static modifier. |
static int | STRICT The int value representing the strictfp modifier. |
static int | SYNCHRONIZED The int value representing the synchronized modifier. |
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 boolean | isAbstract(int mod) Return true if the integer argument includes theabstract modifier, false otherwise. |
static boolean | isFinal(int mod) Return true if the integer argument includes thefinal modifier, false otherwise. |
static boolean | isInterface(int mod) Return true if the integer argument includes theinterface modifier, false otherwise. |
static boolean | isNative(int mod) Return true if the integer argument includes thenative modifier, false otherwise. |
static boolean | isPrivate(int mod) Return true if the integer argument includes theprivate modifier, false otherwise. |
static boolean | isProtected(int mod) Return true if the integer argument includes theprotected modifier, false otherwise. |
static boolean | isPublic(int mod) Return true if the integer argument includes thepublic modifier, false otherwise. |
static boolean | isStatic(int mod) Return true if the integer argument includes thestatic modifier, false otherwise. |
static boolean | isStrict(int mod) Return true if the integer argument includes thestrictfp modifier, false otherwise. |
static boolean | isSynchronized(int mod) Return true if the integer argument includes thesynchronized modifier, false otherwise. |
static boolean | isTransient(int mod) Return true if the integer argument includes thetransient modifier, false otherwise. |
static boolean | isVolatile(int mod) Return true if the integer argument includes thevolatile modifier, 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../../java/lang/Object.html#wait%28long, int%29) |
Field Detail |
---|
PUBLIC
public static final int PUBLIC
The int
value representing the public
modifier.
See Also:
PRIVATE
public static final int PRIVATE
The int
value representing the private
modifier.
See Also:
PROTECTED
public static final int PROTECTED
The int
value representing the protected
modifier.
See Also:
STATIC
public static final int STATIC
The int
value representing the static
modifier.
See Also:
FINAL
public static final int FINAL
The int
value representing the final
modifier.
See Also:
SYNCHRONIZED
public static final int SYNCHRONIZED
The int
value representing the synchronized
modifier.
See Also:
VOLATILE
public static final int VOLATILE
The int
value representing the volatile
modifier.
See Also:
TRANSIENT
public static final int TRANSIENT
The int
value representing the transient
modifier.
See Also:
NATIVE
public static final int NATIVE
The int
value representing the native
modifier.
See Also:
INTERFACE
public static final int INTERFACE
The int
value representing the interface
modifier.
See Also:
ABSTRACT
public static final int ABSTRACT
The int
value representing the abstract
modifier.
See Also:
STRICT
public static final int STRICT
The int
value representing the strictfp
modifier.
See Also:
Constructor Detail |
---|
Modifier
public Modifier()
Method Detail |
---|
isPublic
public static boolean isPublic(int mod)
Return true if the integer argument includes thepublic modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thepublic modifier; false otherwise.
isPrivate
public static boolean isPrivate(int mod)
Return true if the integer argument includes theprivate modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes theprivate modifier; false otherwise.
isProtected
public static boolean isProtected(int mod)
Return true if the integer argument includes theprotected modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes theprotected modifier; false otherwise.
isStatic
public static boolean isStatic(int mod)
Return true if the integer argument includes thestatic modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thestatic modifier; false otherwise.
isFinal
public static boolean isFinal(int mod)
Return true if the integer argument includes thefinal modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thefinal modifier; false otherwise.
isSynchronized
public static boolean isSynchronized(int mod)
Return true if the integer argument includes thesynchronized modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thesynchronized modifier; false otherwise.
isVolatile
public static boolean isVolatile(int mod)
Return true if the integer argument includes thevolatile modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thevolatile modifier; false otherwise.
isTransient
public static boolean isTransient(int mod)
Return true if the integer argument includes thetransient modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thetransient modifier; false otherwise.
isNative
public static boolean isNative(int mod)
Return true if the integer argument includes thenative modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thenative modifier; false otherwise.
isInterface
public static boolean isInterface(int mod)
Return true if the integer argument includes theinterface modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes theinterface modifier; false otherwise.
isAbstract
public static boolean isAbstract(int mod)
Return true if the integer argument includes theabstract modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes theabstract modifier; false otherwise.
isStrict
public static boolean isStrict(int mod)
Return true if the integer argument includes thestrictfp modifier, false otherwise.
Parameters:
mod
- a set of modifiers
Returns:
true if mod
includes thestrictfp 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 modifiers
Returns:
a string representation of the set of modifiers represented by mod
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.