Package java.lang.reflect
Class Modifier
java.lang.Object
java.lang.reflect.Modifier
public class Modifier extends Object
This class provides static methods to decode class and member modifiers.
- See Also:
Class.getModifiers(),Member.getModifiers()
-
Field Summary
Fields Modifier and Type Field Description static intABSTRACTTheintvalue representing theabstractmodifier.static intCONSTRUCTORDex addition to mark instance constructors and static class initializer methods.static intFINALTheintvalue representing thefinalmodifier.static intINTERFACETheintvalue representing theinterfacemodifier.static intMIRANDAMiranda methods are fabrications to reserve virtual method table slots in abstract classes that implement interfaces without declaring the abstract methods that the interface would require they implement.static intNATIVETheintvalue representing thenativemodifier.static intPRIVATETheintvalue representing theprivatemodifier.static intPROTECTEDTheintvalue representing theprotectedmodifier.static intPUBLICTheintvalue representing thepublicmodifier.static intSTATICTheintvalue representing thestaticmodifier.static intSTRICTTheintvalue representing thestrictfpmodifier.static intSYNCHRONIZEDTheintvalue representing thesynchronizedmodifier.static intSYNTHETICstatic intTRANSIENTTheintvalue representing thetransientmodifier.static intVOLATILETheintvalue representing thevolatilemodifier. -
Constructor Summary
Constructors Constructor Description Modifier()Constructs a newModifierinstance. -
Method Summary
Modifier and Type Method Description static intclassModifiers()Returns a mask of all the modifiers that may be applied to classes.static intconstructorModifiers()Returns a mask of all the modifiers that may be applied to constructors.static intfieldModifiers()Returns a mask of all the modifiers that may be applied to fields.static intinterfaceModifiers()Returns a mask of all the modifiers that may be applied to interfaces.static booleanisAbstract(int modifiers)Returns true if the given modifiers containABSTRACT.static booleanisConstructor(int modifiers)Returns true if the given modifiers containCONSTRUCTOR.static booleanisFinal(int modifiers)Returns true if the given modifiers containFINAL.static booleanisInterface(int modifiers)Returns true if the given modifiers containINTERFACE.static booleanisNative(int modifiers)Returns true if the given modifiers containNATIVE.static booleanisPrivate(int modifiers)Returns true if the given modifiers containPRIVATE.static booleanisProtected(int modifiers)Returns true if the given modifiers containPROTECTED.static booleanisPublic(int modifiers)Returns true if the given modifiers containPUBLIC.static booleanisStatic(int modifiers)Returns true if the given modifiers containSTATIC.static booleanisStrict(int modifiers)Returns true if the given modifiers containSTRICT.static booleanisSynchronized(int modifiers)Returns true if the given modifiers containSYNCHRONIZED.static booleanisTransient(int modifiers)Returns true if the given modifiers containTRANSIENT.static booleanisVolatile(int modifiers)Returns true if the given modifiers containVOLATILE.static intmethodModifiers()Returns a mask of all the modifiers that may be applied to methods.static StringtoString(int modifiers)Returns a string containing the string representation of all modifiers present in the specified modifiers.
-
Field Details
-
PUBLIC
public static final int PUBLICTheintvalue representing thepublicmodifier.- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATETheintvalue representing theprivatemodifier.- See Also:
- Constant Field Values
-
PROTECTED
public static final int PROTECTEDTheintvalue representing theprotectedmodifier.- See Also:
- Constant Field Values
-
STATIC
public static final int STATICTheintvalue representing thestaticmodifier.- See Also:
- Constant Field Values
-
FINAL
public static final int FINALTheintvalue representing thefinalmodifier.- See Also:
- Constant Field Values
-
SYNCHRONIZED
public static final int SYNCHRONIZEDTheintvalue representing thesynchronizedmodifier.- See Also:
- Constant Field Values
-
VOLATILE
public static final int VOLATILETheintvalue representing thevolatilemodifier.- See Also:
- Constant Field Values
-
TRANSIENT
public static final int TRANSIENTTheintvalue representing thetransientmodifier.- See Also:
- Constant Field Values
-
NATIVE
public static final int NATIVETheintvalue representing thenativemodifier.- See Also:
- Constant Field Values
-
INTERFACE
public static final int INTERFACETheintvalue representing theinterfacemodifier.- See Also:
- Constant Field Values
-
ABSTRACT
public static final int ABSTRACTTheintvalue representing theabstractmodifier.- See Also:
- Constant Field Values
-
STRICT
public static final int STRICTTheintvalue representing thestrictfpmodifier.- See Also:
- Constant Field Values
-
SYNTHETIC
public static final int SYNTHETIC- See Also:
- Constant Field Values
-
MIRANDA
public static final int MIRANDAMiranda methods are fabrications to reserve virtual method table slots in abstract classes that implement interfaces without declaring the abstract methods that the interface would require they implement.- See Also:
- Constant Field Values
-
CONSTRUCTOR
public static final int CONSTRUCTORDex addition to mark instance constructors and static class initializer methods.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Modifier
public Modifier()Constructs a newModifierinstance.
-
-
Method Details
-
classModifiers
public static int classModifiers()Returns a mask of all the modifiers that may be applied to classes.- Since:
- 1.7
-
constructorModifiers
public static int constructorModifiers()Returns a mask of all the modifiers that may be applied to constructors.- Since:
- 1.7
-
fieldModifiers
public static int fieldModifiers()Returns a mask of all the modifiers that may be applied to fields.- Since:
- 1.7
-
interfaceModifiers
public static int interfaceModifiers()Returns a mask of all the modifiers that may be applied to interfaces.- Since:
- 1.7
-
methodModifiers
public static int methodModifiers()Returns a mask of all the modifiers that may be applied to methods.- Since:
- 1.7
-
isAbstract
public static boolean isAbstract(int modifiers)Returns true if the given modifiers containABSTRACT. -
isFinal
public static boolean isFinal(int modifiers)Returns true if the given modifiers containFINAL. -
isInterface
public static boolean isInterface(int modifiers)Returns true if the given modifiers containINTERFACE. -
isNative
public static boolean isNative(int modifiers)Returns true if the given modifiers containNATIVE. -
isPrivate
public static boolean isPrivate(int modifiers)Returns true if the given modifiers containPRIVATE. -
isProtected
public static boolean isProtected(int modifiers)Returns true if the given modifiers containPROTECTED. -
isPublic
public static boolean isPublic(int modifiers)Returns true if the given modifiers containPUBLIC. -
isStatic
public static boolean isStatic(int modifiers)Returns true if the given modifiers containSTATIC. -
isStrict
public static boolean isStrict(int modifiers)Returns true if the given modifiers containSTRICT. -
isSynchronized
public static boolean isSynchronized(int modifiers)Returns true if the given modifiers containSYNCHRONIZED. -
isTransient
public static boolean isTransient(int modifiers)Returns true if the given modifiers containTRANSIENT. -
isVolatile
public static boolean isVolatile(int modifiers)Returns true if the given modifiers containVOLATILE. -
isConstructor
public static boolean isConstructor(int modifiers)Returns true if the given modifiers containCONSTRUCTOR. -
toString
Returns a string containing the string representation of all modifiers present in the specified modifiers. Modifiers appear in the order specified by the Java Language Specification.
-