|
|||||||||
| Home >> All >> java >> lang >> [ reflect overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.reflect
Class Modifier

java.lang.Objectjava.lang.reflect.Modifier
- public class Modifier
- extends java.lang.Object
Modifier is a helper class with static methods to determine whether an int returned from getModifiers() represents static, public, protected, native, final, etc... and provides an additional method to print out all of the modifiers in an int in order.
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.
- Since:
- 1.1
| Field Summary | |
static int |
ABSTRACT
Abstract: Class: may not be instantiated. Method: may not be called. |
(package private) static int |
ALL_FLAGS
All the flags, only used by code in this package. |
(package private) static int |
BRIDGE
Flag indicating a bridge method. |
(package private) static int |
ENUM
Flag indicating an enum constant or an enum class. |
static int |
FINAL
Final: Class: no subclasses allowed. Field: cannot be changed. Method: cannot be overriden. |
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. Field or Method: can be accessed or invoked without an instance of the declaring class. |
static int |
STRICT
Strictfp: Method: expressions are FP-strict. |
(package private) static int |
SUPER
Super - treat invokespecial as polymorphic so that super.foo() works according to the JLS. |
static int |
SYNCHRONIZED
Synchronized: Method: lock the class while calling this method. |
(package private) static int |
SYNTHETIC
Flag indicating a synthetic member. |
static int |
TRANSIENT
Transient: Field: not serialized or deserialized. |
(package private) static int |
VARARGS
Flag indicating a varargs method. |
static int |
VOLATILE
Volatile: Field: cannot be cached. |
| Constructor Summary | |
Modifier()
This constructor really shouldn't be here ... |
|
| Method Summary | |
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 java.lang.String |
toString(int mod)
Get a string representation of all the modifiers represented by the given int. |
(package private) static java.lang.StringBuffer |
toString(int mod,
java.lang.StringBuffer r)
Package helper method that can take a StringBuffer. |
(package private) static java.lang.StringBuilder |
toString(int mod,
java.lang.StringBuilder r)
Package helper method that can take a StringBuilder. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
PUBLIC
public static final int PUBLIC
- Public: accessible from any other class.
- See Also:
- Constant Field Values
PRIVATE
public static final int PRIVATE
- Private: accessible only from the same enclosing class.
- See Also:
- Constant Field Values
PROTECTED
public static final int PROTECTED
- Protected: accessible only to subclasses, or within the package.
- See Also:
- Constant Field Values
STATIC
public static final int STATIC
- Static:
- Class: no enclosing instance for nested class.
- Field or Method: can be accessed or invoked without an instance of the declaring class.
- See Also:
- Constant Field Values
FINAL
public static final int FINAL
- Final:
- Class: no subclasses allowed.
- Field: cannot be changed.
- Method: cannot be overriden.
- See Also:
- Constant Field Values
SYNCHRONIZED
public static final int SYNCHRONIZED
- Synchronized: Method: lock the class while calling this method.
- See Also:
- Constant Field Values
VOLATILE
public static final int VOLATILE
- Volatile: Field: cannot be cached.
- See Also:
- Constant Field Values
TRANSIENT
public static final int TRANSIENT
- Transient: Field: not serialized or deserialized.
- See Also:
- Constant Field Values
NATIVE
public static final int NATIVE
- Native: Method: use JNI to call this method.
- See Also:
- Constant Field Values
INTERFACE
public static final int INTERFACE
- Interface: Class: is an interface.
- See Also:
- Constant Field Values
ABSTRACT
public static final int ABSTRACT
- Abstract:
- Class: may not be instantiated.
- Method: may not be called.
- See Also:
- Constant Field Values
STRICT
public static final int STRICT
- Strictfp: Method: expressions are FP-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.
- See Also:
- Constant Field Values
SUPER
static final int SUPER
- Super - treat invokespecial as polymorphic so that super.foo() works
according to the JLS. This is a reuse of the synchronized constant
to patch a hole in JDK 1.0. *shudder*.
- See Also:
- Constant Field Values
ALL_FLAGS
static final int ALL_FLAGS
- All the flags, only used by code in this package.
- See Also:
- Constant Field Values
BRIDGE
static final int BRIDGE
- Flag indicating a bridge method.
- See Also:
- Constant Field Values
VARARGS
static final int VARARGS
- Flag indicating a varargs method.
- See Also:
- Constant Field Values
SYNTHETIC
static final int SYNTHETIC
- Flag indicating a synthetic member.
- See Also:
- Constant Field Values
ENUM
static final int ENUM
- Flag indicating an enum constant or an enum class.
- See Also:
- Constant Field Values
| Constructor Detail |
Modifier
public Modifier()
- This constructor really shouldn't be here ... there are no
instance methods or variables of this class, so instantiation is
worthless. However, this function is in the 1.1 spec, so it is added
for completeness.
| Method Detail |
isAbstract
public static boolean isAbstract(int mod)
- Check whether the given modifier is abstract.
isFinal
public static boolean isFinal(int mod)
- Check whether the given modifier is final.
isInterface
public static boolean isInterface(int mod)
- Check whether the given modifier is an interface.
isNative
public static boolean isNative(int mod)
- Check whether the given modifier is native.
isPrivate
public static boolean isPrivate(int mod)
- Check whether the given modifier is private.
isProtected
public static boolean isProtected(int mod)
- Check whether the given modifier is protected.
isPublic
public static boolean isPublic(int mod)
- Check whether the given modifier is public.
isStatic
public static boolean isStatic(int mod)
- Check whether the given modifier is static.
isStrict
public static boolean isStrict(int mod)
- Check whether the given modifier is strictfp.
isSynchronized
public static boolean isSynchronized(int mod)
- Check whether the given modifier is synchronized.
isTransient
public static boolean isTransient(int mod)
- Check whether the given modifier is transient.
isVolatile
public static boolean isVolatile(int mod)
- Check whether the given modifier is volatile.
toString
public static java.lang.String toString(int mod)
- Get a string representation of all the modifiers represented by the
given int. The keywords are printed in this order:
<public|protected|private> abstract static final transient volatile synchronized native strictfp interface.
toString
static java.lang.StringBuilder toString(int mod, java.lang.StringBuilder r)
- Package helper method that can take a StringBuilder.
toString
static java.lang.StringBuffer toString(int mod, java.lang.StringBuffer r)
- Package helper method that can take a StringBuffer.
|
|||||||||
| Home >> All >> java >> lang >> [ reflect overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.lang.reflect.Modifier