public class Modifier extends Object
The methods in this class use the bitmask values in the VM spec to determine the modifiers of an int. This means that a VM must return a standard mask, conformant with the VM spec. I don't know if this is how Sun does it, but I'm willing to bet money that it is.
Member.getModifiers()
,
Method.getModifiers()
,
Field.getModifiers()
,
Constructor.getModifiers()
,
Class.getModifiers()
Modifier and Type | Field and Description |
---|---|
static int |
ABSTRACT
Abstract:
Class: may not be instantiated. |
static int |
FINAL
Final:
Class: no subclasses allowed. |
static int |
INTERFACE
Interface: Class: is an interface.
|
static int |
NATIVE
Native: Method: use JNI to call this method.
|
static int |
PRIVATE
Private: accessible only from the same enclosing class.
|
static int |
PROTECTED
Protected: accessible only to subclasses, or within the package.
|
static int |
PUBLIC
Public: accessible from any other class.
|
static int |
STATIC
Static:
Class: no enclosing instance for nested class. |
static int |
STRICT
Strictfp: Method: expressions are FP-strict.
|
static int |
SYNCHRONIZED
Synchronized: Method: lock the class while calling this method.
|
static int |
TRANSIENT
Transient: Field: not serialized or deserialized.
|
static int |
VOLATILE
Volatile: Field: cannot be cached.
|
Constructor and Description |
---|
Modifier()
This constructor really shouldn't be here ... there are no
instance methods or variables of this class, so instantiation is
worthless.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isAbstract(int mod)
Check whether the given modifier is abstract.
|
static boolean |
isFinal(int mod)
Check whether the given modifier is final.
|
static boolean |
isInterface(int mod)
Check whether the given modifier is an interface.
|
static boolean |
isNative(int mod)
Check whether the given modifier is native.
|
static boolean |
isPrivate(int mod)
Check whether the given modifier is private.
|
static boolean |
isProtected(int mod)
Check whether the given modifier is protected.
|
static boolean |
isPublic(int mod)
Check whether the given modifier is public.
|
static boolean |
isStatic(int mod)
Check whether the given modifier is static.
|
static boolean |
isStrict(int mod)
Check whether the given modifier is strictfp.
|
static boolean |
isSynchronized(int mod)
Check whether the given modifier is synchronized.
|
static boolean |
isTransient(int mod)
Check whether the given modifier is transient.
|
static boolean |
isVolatile(int mod)
Check whether the given modifier is volatile.
|
static String |
toString(int mod)
Get a string representation of all the modifiers represented by the
given int.
|
public static final int PUBLIC
public static final int PRIVATE
public static final int PROTECTED
public static final int STATIC
public static final int FINAL
public static final int SYNCHRONIZED
public static final int VOLATILE
public static final int TRANSIENT
public static final int NATIVE
public static final int INTERFACE
public static final int ABSTRACT
public static final int STRICT
Also used as a modifier for classes, to mean that all initializers and constructors are FP-strict, but does not show up in Class.getModifiers.
public Modifier()
public static boolean isAbstract(int mod)
mod
- the modifier.true
if abstract, false
otherwise.public static boolean isFinal(int mod)
mod
- the modifier.true
if final, false
otherwise.public static boolean isInterface(int mod)
mod
- the modifier.true
if an interface, false
otherwise.public static boolean isNative(int mod)
mod
- the modifier.true
if native, false
otherwise.public static boolean isPrivate(int mod)
mod
- the modifier.true
if private, false
otherwise.public static boolean isProtected(int mod)
mod
- the modifier.true
if protected, false
otherwise.public static boolean isPublic(int mod)
mod
- the modifier.true
if public, false
otherwise.public static boolean isStatic(int mod)
mod
- the modifier.true
if static, false
otherwise.public static boolean isStrict(int mod)
mod
- the modifier.true
if strictfp, false
otherwise.public static boolean isSynchronized(int mod)
mod
- the modifier.true
if synchronized, false
otherwise.public static boolean isTransient(int mod)
mod
- the modifier.true
if transient, false
otherwise.public static boolean isVolatile(int mod)
mod
- the modifier.true
if volatile, false
otherwise.public static String toString(int mod)
<public|protected|private> abstract static final transient
volatile synchronized native strictfp interface
.mod
- the modifier.