- java.lang.Object
- 
- java.lang.reflect.Modifier
 
- 
 public class Modifier extends Object The Modifier class providesstaticmethods 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 tables in sections 4.1, 4.4, 4.5, and 4.7 of The Java™ Virtual Machine Specification.- Since:
- 1.1
- See Also:
- Class.getModifiers(),- Member.getModifiers()
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intABSTRACTTheintvalue representing theabstractmodifier.static intFINALTheintvalue representing thefinalmodifier.static intINTERFACETheintvalue representing theinterfacemodifier.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 intTRANSIENTTheintvalue representing thetransientmodifier.static intVOLATILETheintvalue representing thevolatilemodifier.
 - 
Constructor SummaryConstructors Constructor Description Modifier()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static intclassModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to a class.static intconstructorModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to a constructor.static intfieldModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to a field.static intinterfaceModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to an interface.static booleanisAbstract(int mod)Returntrueif the integer argument includes theabstractmodifier,falseotherwise.static booleanisFinal(int mod)Returntrueif the integer argument includes thefinalmodifier,falseotherwise.static booleanisInterface(int mod)Returntrueif the integer argument includes theinterfacemodifier,falseotherwise.static booleanisNative(int mod)Returntrueif the integer argument includes thenativemodifier,falseotherwise.static booleanisPrivate(int mod)Returntrueif the integer argument includes theprivatemodifier,falseotherwise.static booleanisProtected(int mod)Returntrueif the integer argument includes theprotectedmodifier,falseotherwise.static booleanisPublic(int mod)Returntrueif the integer argument includes thepublicmodifier,falseotherwise.static booleanisStatic(int mod)Returntrueif the integer argument includes thestaticmodifier,falseotherwise.static booleanisStrict(int mod)Returntrueif the integer argument includes thestrictfpmodifier,falseotherwise.static booleanisSynchronized(int mod)Returntrueif the integer argument includes thesynchronizedmodifier,falseotherwise.static booleanisTransient(int mod)Returntrueif the integer argument includes thetransientmodifier,falseotherwise.static booleanisVolatile(int mod)Returntrueif the integer argument includes thevolatilemodifier,falseotherwise.static intmethodModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to a method.static intparameterModifiers()Return anintvalue OR-ing together the source language modifiers that can be applied to a parameter.static StringtoString(int mod)Return a string describing the access modifier flags in the specified modifier.
 
- 
- 
- 
Field Detail- 
PUBLICpublic static final int PUBLIC Theintvalue representing thepublicmodifier.- See Also:
- Constant Field Values
 
 - 
PRIVATEpublic static final int PRIVATE Theintvalue representing theprivatemodifier.- See Also:
- Constant Field Values
 
 - 
PROTECTEDpublic static final int PROTECTED Theintvalue representing theprotectedmodifier.- See Also:
- Constant Field Values
 
 - 
STATICpublic static final int STATIC Theintvalue representing thestaticmodifier.- See Also:
- Constant Field Values
 
 - 
FINALpublic static final int FINAL Theintvalue representing thefinalmodifier.- See Also:
- Constant Field Values
 
 - 
SYNCHRONIZEDpublic static final int SYNCHRONIZED Theintvalue representing thesynchronizedmodifier.- See Also:
- Constant Field Values
 
 - 
VOLATILEpublic static final int VOLATILE Theintvalue representing thevolatilemodifier.- See Also:
- Constant Field Values
 
 - 
TRANSIENTpublic static final int TRANSIENT Theintvalue representing thetransientmodifier.- See Also:
- Constant Field Values
 
 - 
NATIVEpublic static final int NATIVE Theintvalue representing thenativemodifier.- See Also:
- Constant Field Values
 
 - 
INTERFACEpublic static final int INTERFACE Theintvalue representing theinterfacemodifier.- See Also:
- Constant Field Values
 
 - 
ABSTRACTpublic static final int ABSTRACT Theintvalue representing theabstractmodifier.- See Also:
- Constant Field Values
 
 - 
STRICTpublic static final int STRICT Theintvalue representing thestrictfpmodifier.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
isPublicpublic static boolean isPublic(int mod) Returntrueif the integer argument includes thepublicmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- publicmodifier;- falseotherwise.
 
 - 
isPrivatepublic static boolean isPrivate(int mod) Returntrueif the integer argument includes theprivatemodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- privatemodifier;- falseotherwise.
 
 - 
isProtectedpublic static boolean isProtected(int mod) Returntrueif the integer argument includes theprotectedmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- protectedmodifier;- falseotherwise.
 
 - 
isStaticpublic static boolean isStatic(int mod) Returntrueif the integer argument includes thestaticmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- staticmodifier;- falseotherwise.
 
 - 
isFinalpublic static boolean isFinal(int mod) Returntrueif the integer argument includes thefinalmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- finalmodifier;- falseotherwise.
 
 - 
isSynchronizedpublic static boolean isSynchronized(int mod) Returntrueif the integer argument includes thesynchronizedmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- synchronizedmodifier;- falseotherwise.
 
 - 
isVolatilepublic static boolean isVolatile(int mod) Returntrueif the integer argument includes thevolatilemodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- volatilemodifier;- falseotherwise.
 
 - 
isTransientpublic static boolean isTransient(int mod) Returntrueif the integer argument includes thetransientmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- transientmodifier;- falseotherwise.
 
 - 
isNativepublic static boolean isNative(int mod) Returntrueif the integer argument includes thenativemodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- nativemodifier;- falseotherwise.
 
 - 
isInterfacepublic static boolean isInterface(int mod) Returntrueif the integer argument includes theinterfacemodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- interfacemodifier;- falseotherwise.
 
 - 
isAbstractpublic static boolean isAbstract(int mod) Returntrueif the integer argument includes theabstractmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- abstractmodifier;- falseotherwise.
 
 - 
isStrictpublic static boolean isStrict(int mod) Returntrueif the integer argument includes thestrictfpmodifier,falseotherwise.- Parameters:
- mod- a set of modifiers
- Returns:
- trueif- modincludes the- strictfpmodifier;- falseotherwise.
 
 - 
toStringpublic static String toString(int mod) Return a string describing the access modifier flags in the specified modifier. For example:
 The modifier names are returned in an order consistent with the suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of The Java™ Language Specification. The full modifier ordering used by this method is:public final synchronized strictfp
 Thepublic protected private abstract static final transient volatile synchronized native strictfp interfaceinterfacemodifier 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. Note that to perform such checking for a known kind of entity, such as a constructor or method, first AND the argument oftoStringwith the appropriate mask from a method likeconstructorModifiers()ormethodModifiers().- Parameters:
- mod- a set of modifiers
- Returns:
- a string representation of the set of modifiers
 represented by mod
 
 - 
classModifierspublic static int classModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to a class.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to a class.
- Since:
- 1.7
- See The Java™ Language Specification:
- 8.1.1 Class Modifiers
 
 - 
interfaceModifierspublic static int interfaceModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to an interface.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to an interface.
- Since:
- 1.7
- See The Java™ Language Specification:
- 9.1.1 Interface Modifiers
 
 - 
constructorModifierspublic static int constructorModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to a constructor.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to a constructor.
- Since:
- 1.7
- See The Java™ Language Specification:
- 8.8.3 Constructor Modifiers
 
 - 
methodModifierspublic static int methodModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to a method.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to a method.
- Since:
- 1.7
- See The Java™ Language Specification:
- 8.4.3 Method Modifiers
 
 - 
fieldModifierspublic static int fieldModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to a field.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to a field.
- Since:
- 1.7
- See The Java™ Language Specification:
- 8.3.1 Field Modifiers
 
 - 
parameterModifierspublic static int parameterModifiers() Return anintvalue OR-ing together the source language modifiers that can be applied to a parameter.- Returns:
- an intvalue OR-ing together the source language modifiers that can be applied to a parameter.
- Since:
- 1.8
- See The Java™ Language Specification:
- 8.4.1 Formal Parameters
 
 
- 
 
-