Package com.tonic.util
Class Modifiers
- java.lang.Object
-
- com.tonic.util.Modifiers
-
public final class Modifiers extends Object
Utility class for constructing and checking access flags in Java class files.
-
-
Field Summary
Fields Modifier and Type Field Description static intABSTRACTstatic intANNOTATIONstatic intBRIDGEstatic intENUMstatic intFINALstatic intINTERFACEstatic intNATIVEstatic intPRIVATEstatic intPROTECTEDstatic intPUBLICstatic intSTATICstatic intSTRICTstatic intSYNCHRONIZEDstatic intSYNTHETICstatic intTRANSIENTstatic intVARARGSstatic intVOLATILE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisAbstract(int mod)Checks if the access flags indicate that the entity is abstract.static booleanisAnnotation(int mod)Checks if the access flags indicate that the entity is an annotation.static booleanisBridge(int mod)Checks if the access flags indicate that the entity is a bridge method.static booleanisEnum(int mod)Checks if the access flags indicate that the entity is an enum.static booleanisFinal(int mod)Checks if the access flags indicate that the entity is final.static booleanisInterface(int mod)Checks if the access flags indicate that the entity is an interface.static booleanisNative(int mod)Checks if the access flags indicate that the entity is native.static booleanisPackagePrivate(int mod)Determines if the entity has package-private visibility.static booleanisPrivate(int mod)Checks if the access flags indicate that the entity is private.static booleanisProtected(int mod)Checks if the access flags indicate that the entity is protected.static booleanisPublic(int mod)Checks if the access flags indicate that the entity is public.static booleanisStatic(int mod)Checks if the access flags indicate that the entity is static.static booleanisStrict(int mod)Checks if the access flags indicate that the entity is strictfp.static booleanisSynchronized(int mod)Checks if the access flags indicate that the entity is synchronized.static booleanisSynthetic(int mod)Checks if the access flags indicate that the entity is synthetic.static booleanisTransient(int mod)Checks if the access flags indicate that the entity is transient.static booleanisVarArgs(int mod)Checks if the access flags indicate that the method has variable arguments.static booleanisVolatile(int mod)Checks if the access flags indicate that the entity is volatile.static intsetAbstract(int mod)Sets theabstractaccess flag.static intsetAnnotation(int mod)Sets theannotationaccess flag.static intsetBridge(int mod)Sets thebridgeaccess flag.static intsetEnum(int mod)Sets theenumaccess flag.static intsetFinal(int mod)Sets thefinalaccess flag.static intsetInterface(int mod)Sets theinterfaceaccess flag.static intsetNative(int mod)Sets thenativeaccess flag.static intsetPrivate(int mod)Sets theprivateaccess flag.static intsetProtected(int mod)Sets theprotectedaccess flag.static intsetPublic(int mod)Sets thepublicaccess flag.static intsetStatic(int mod)Sets thestaticaccess flag.static intsetStrict(int mod)Sets thestrictfpaccess flag.static intsetSynchronized(int mod)Sets thesynchronizedaccess flag.static intsetSynthetic(int mod)Sets thesyntheticaccess flag.static intsetTransient(int mod)Sets thetransientaccess flag.static intsetVarArgs(int mod)Sets thevarargsaccess flag.static intsetVolatile(int mod)Sets thevolatileaccess flag.static StringtoString(int mod)Returns a string describing the access modifier flags in the specified modifier.
-
-
-
Field Detail
-
PUBLIC
public static final int PUBLIC
- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATE
- See Also:
- Constant Field Values
-
PROTECTED
public static final int PROTECTED
- See Also:
- Constant Field Values
-
STATIC
public static final int STATIC
- See Also:
- Constant Field Values
-
FINAL
public static final int FINAL
- See Also:
- Constant Field Values
-
SYNCHRONIZED
public static final int SYNCHRONIZED
- See Also:
- Constant Field Values
-
BRIDGE
public static final int BRIDGE
- See Also:
- Constant Field Values
-
VARARGS
public static final int VARARGS
- See Also:
- Constant Field Values
-
NATIVE
public static final int NATIVE
- See Also:
- Constant Field Values
-
INTERFACE
public static final int INTERFACE
- See Also:
- Constant Field Values
-
ABSTRACT
public static final int ABSTRACT
- See Also:
- Constant Field Values
-
STRICT
public static final int STRICT
- See Also:
- Constant Field Values
-
SYNTHETIC
public static final int SYNTHETIC
- See Also:
- Constant Field Values
-
ANNOTATION
public static final int ANNOTATION
- See Also:
- Constant Field Values
-
ENUM
public static final int ENUM
- See Also:
- Constant Field Values
-
VOLATILE
public static final int VOLATILE
- See Also:
- Constant Field Values
-
TRANSIENT
public static final int TRANSIENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPublic
public static int setPublic(int mod)
Sets thepublicaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
publicset
-
setPrivate
public static int setPrivate(int mod)
Sets theprivateaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
privateset
-
setProtected
public static int setProtected(int mod)
Sets theprotectedaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
protectedset
-
setStatic
public static int setStatic(int mod)
Sets thestaticaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
staticset
-
setInterface
public static int setInterface(int mod)
Sets theinterfaceaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
interfaceset
-
setFinal
public static int setFinal(int mod)
Sets thefinalaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
finalset
-
setSynchronized
public static int setSynchronized(int mod)
Sets thesynchronizedaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
synchronizedset
-
setBridge
public static int setBridge(int mod)
Sets thebridgeaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
bridgeset
-
setVarArgs
public static int setVarArgs(int mod)
Sets thevarargsaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
varargsset
-
setNative
public static int setNative(int mod)
Sets thenativeaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
nativeset
-
setAbstract
public static int setAbstract(int mod)
Sets theabstractaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
abstractset
-
setStrict
public static int setStrict(int mod)
Sets thestrictfpaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
strictfpset
-
setSynthetic
public static int setSynthetic(int mod)
Sets thesyntheticaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
syntheticset
-
setAnnotation
public static int setAnnotation(int mod)
Sets theannotationaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
annotationset
-
setEnum
public static int setEnum(int mod)
Sets theenumaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
enumset
-
setVolatile
public static int setVolatile(int mod)
Sets thevolatileaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
volatileset
-
setTransient
public static int setTransient(int mod)
Sets thetransientaccess flag.- Parameters:
mod- the current access flags- Returns:
- the updated access flags with
transientset
-
isPublic
public static boolean isPublic(int mod)
Checks if the access flags indicate that the entity is public.- Parameters:
mod- the access flags integer- Returns:
trueif the public flag is set,falseotherwise
-
isPrivate
public static boolean isPrivate(int mod)
Checks if the access flags indicate that the entity is private.- Parameters:
mod- the access flags integer- Returns:
trueif the private flag is set,falseotherwise
-
isProtected
public static boolean isProtected(int mod)
Checks if the access flags indicate that the entity is protected.- Parameters:
mod- the access flags integer- Returns:
trueif the protected flag is set,falseotherwise
-
isStatic
public static boolean isStatic(int mod)
Checks if the access flags indicate that the entity is static.- Parameters:
mod- the access flags integer- Returns:
trueif the static flag is set,falseotherwise
-
isFinal
public static boolean isFinal(int mod)
Checks if the access flags indicate that the entity is final.- Parameters:
mod- the access flags integer- Returns:
trueif the final flag is set,falseotherwise
-
isSynchronized
public static boolean isSynchronized(int mod)
Checks if the access flags indicate that the entity is synchronized.- Parameters:
mod- the access flags integer- Returns:
trueif the synchronized flag is set,falseotherwise
-
isBridge
public static boolean isBridge(int mod)
Checks if the access flags indicate that the entity is a bridge method.- Parameters:
mod- the access flags integer- Returns:
trueif the bridge flag is set,falseotherwise
-
isVarArgs
public static boolean isVarArgs(int mod)
Checks if the access flags indicate that the method has variable arguments.- Parameters:
mod- the access flags integer- Returns:
trueif the varargs flag is set,falseotherwise
-
isNative
public static boolean isNative(int mod)
Checks if the access flags indicate that the entity is native.- Parameters:
mod- the access flags integer- Returns:
trueif the native flag is set,falseotherwise
-
isAbstract
public static boolean isAbstract(int mod)
Checks if the access flags indicate that the entity is abstract.- Parameters:
mod- the access flags integer- Returns:
trueif the abstract flag is set,falseotherwise
-
isStrict
public static boolean isStrict(int mod)
Checks if the access flags indicate that the entity is strictfp.- Parameters:
mod- the access flags integer- Returns:
trueif the strictfp flag is set,falseotherwise
-
isSynthetic
public static boolean isSynthetic(int mod)
Checks if the access flags indicate that the entity is synthetic.- Parameters:
mod- the access flags integer- Returns:
trueif the synthetic flag is set,falseotherwise
-
isAnnotation
public static boolean isAnnotation(int mod)
Checks if the access flags indicate that the entity is an annotation.- Parameters:
mod- the access flags integer- Returns:
trueif the annotation flag is set,falseotherwise
-
isEnum
public static boolean isEnum(int mod)
Checks if the access flags indicate that the entity is an enum.- Parameters:
mod- the access flags integer- Returns:
trueif the enum flag is set,falseotherwise
-
isInterface
public static boolean isInterface(int mod)
Checks if the access flags indicate that the entity is an interface.- Parameters:
mod- the access flags integer- Returns:
trueif the interface flag is set,falseotherwise
-
isVolatile
public static boolean isVolatile(int mod)
Checks if the access flags indicate that the entity is volatile.- Parameters:
mod- the access flags integer- Returns:
trueif the volatile flag is set,falseotherwise
-
isTransient
public static boolean isTransient(int mod)
Checks if the access flags indicate that the entity is transient.- Parameters:
mod- the access flags integer- Returns:
trueif the transient flag is set,falseotherwise
-
isPackagePrivate
public static boolean isPackagePrivate(int mod)
Determines if the entity has package-private visibility.- Parameters:
mod- the access flags integer- Returns:
trueif the entity has package-private visibility,falseotherwise
-
toString
public static String toString(int mod)
Returns a string describing the access modifier flags in the specified modifier.- Parameters:
mod- modifier flags.- Returns:
- a string representation of the modifiers
-
-