Package org.codehaus.janino
Class Mod
- java.lang.Object
-
- org.codehaus.janino.Mod
-
public final class Mod extends java.lang.ObjectThis class defines constants and convenience methods for the handling of modifiers as defined by the JVM.Notice: This class should be named
IClass.IModifier, but changing the name would break existing client code. Thus it won't be renamed until there's a really good reason to do it (maybe with a major design change).
-
-
Field Summary
Fields Modifier and Type Field Description static shortABSTRACTThis flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive withFINAL,NATIVE,PRIVATE,STATICandSYNCHRONIZED.static shortANNOTATIONThis flag is set on annotation types (including nested annotation types), and requires thatINTERFACEis also set.static shortBRIDGEThis flag is set on 'bridge methods' generated by the compiler.static shortENUMThis flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is mutually exclusive withINTERFACE.static shortFINALstatic shortINTERFACEThis flag is set on interfaces (including nested interfaces), and requires thatABSTRACTmust also be set.static shortNATIVEThis flag is set on NATIVE methods, and is mutually exclusive withABSTRACT.static shortNONEAn alias for '0' -- no modifiers.static shortPACKAGEThe flag indicating 'default accessibility' a.k.a.static shortPPPThe mask to select the accessibility flags from modifiers.static shortPRIVATEThe flag indicating 'private accessibility' of the modified element.static shortPROTECTEDThe flag indicating 'protected accessibility' of the modified element.static shortPUBLICThe flag indicating 'public accessibility' of the modified element.static shortSTATICThis flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC methods, and STATIC nested classes.static shortSTRICTFPThis flag is set on STRICTFP methods, and is mutually exclusive withABSTRACT.static shortSUPERThis flag is always set on classes, and never set on any other element.static shortSYNCHRONIZEDThis flag is set on SYNCHRONIZED methods.static shortSYNTHETICThis flag is set on classes, methods and fields that were generated by the compiler and do not appear in the source code.static shortTRANSIENTThis flag is set on TRANSIENT fields.static shortVARARGSThis flag is set on 'variable arity' (a.k.a.static shortVOLATILEThis flag is set on VOLATILE fields and is mutually exclusive withFINAL.
-
Constructor Summary
Constructors Modifier Constructor Description privateMod()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static shortchangeAccess(short modifiers, short newAccess)static booleanisAbstract(short sh)static booleanisAnnotation(short sh)static booleanisBridge(short sh)static booleanisEnum(short sh)static booleanisFinal(short sh)static booleanisInterface(short sh)static booleanisNative(short sh)static booleanisPackageAccess(short sh)static booleanisPrivateAccess(short sh)static booleanisProtectedAccess(short sh)static booleanisPublicAccess(short sh)static booleanisStatic(short sh)static booleanisStrictfp(short sh)static booleanisSuper(short sh)static booleanisSynchronized(short sh)static booleanisSynthetic(short sh)static booleanisTransient(short sh)static booleanisVarargs(short sh)static booleanisVolatile(short sh)
-
-
-
Field Detail
-
NONE
public static final short NONE
An alias for '0' -- no modifiers.- See Also:
- Constant Field Values
-
PUBLIC
public static final short PUBLIC
The flag indicating 'public accessibility' of the modified element. Methods of interfaces are alwaysPUBLIC.- See Also:
PPP,isPublicAccess(short), Constant Field Values
-
PRIVATE
public static final short PRIVATE
The flag indicating 'private accessibility' of the modified element.- See Also:
PPP,isPrivateAccess(short), Constant Field Values
-
PROTECTED
public static final short PROTECTED
The flag indicating 'protected accessibility' of the modified element.- See Also:
PPP,isProtectedAccess(short), Constant Field Values
-
PACKAGE
public static final short PACKAGE
The flag indicating 'default accessibility' a.k.a. 'package accessibility' of the modified element.- See Also:
PPP,isPackageAccess(short), Constant Field Values
-
PPP
public static final short PPP
The mask to select the accessibility flags from modifiers.- See Also:
- Constant Field Values
-
STATIC
public static final short STATIC
This flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC methods, and STATIC nested classes.- See Also:
- Constant Field Values
-
FINAL
public static final short FINAL
This flag is set on FINAL classes, FINAL fields and FINAL methods, and is mutually exclusive withVOLATILEandABSTRACT.- See Also:
- Constant Field Values
-
SUPER
public static final short SUPER
This flag is always set on classes, and never set on any other element. Notice that it has the same value asSYNCHRONIZED, which is OK becauseSYNCHRONIZEDis for methods andSUPERfor classes.- See Also:
- Constant Field Values
-
SYNCHRONIZED
public static final short SYNCHRONIZED
This flag is set on SYNCHRONIZED methods. Notice that it has the same value asSUPER, which is OK becauseSYNCHRONIZEDis for methods andSUPERfor classes.- See Also:
- Constant Field Values
-
VOLATILE
public static final short VOLATILE
This flag is set on VOLATILE fields and is mutually exclusive withFINAL. Notice that it has the same value asBRIDGE, which is OK becauseBRIDGEis for methods andVOLATILEfor fields.- See Also:
- Constant Field Values
-
BRIDGE
public static final short BRIDGE
This flag is set on 'bridge methods' generated by the compiler. Notice that it has the same value asVOLATILE, which is OK becauseBRIDGEis for methods andVOLATILEfor fields.- See Also:
- Constant Field Values
-
TRANSIENT
public static final short TRANSIENT
This flag is set on TRANSIENT fields. Notice that it has the same value asVARARGS, which is OK becauseVARARGSis for methods andTRANSIENTfor fields.- See Also:
- Constant Field Values
-
VARARGS
public static final short VARARGS
This flag is set on 'variable arity' (a.k.a. 'varargs') methods and constructors. Notice that it has the same value asTRANSIENT, which is OK becauseVARARGSis for methods andTRANSIENTfor fields.- See Also:
- Constant Field Values
-
NATIVE
public static final short NATIVE
This flag is set on NATIVE methods, and is mutually exclusive withABSTRACT.- See Also:
- Constant Field Values
-
INTERFACE
public static final short INTERFACE
This flag is set on interfaces (including nested interfaces), and requires thatABSTRACTmust also be set.INTERFACEis mutually exclusive withFINAL,SUPERandENUM.- See Also:
- Constant Field Values
-
ABSTRACT
public static final short ABSTRACT
This flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive withFINAL,NATIVE,PRIVATE,STATICandSYNCHRONIZED.- See Also:
- Constant Field Values
-
STRICTFP
public static final short STRICTFP
This flag is set on STRICTFP methods, and is mutually exclusive withABSTRACT.- See Also:
- Constant Field Values
-
SYNTHETIC
public static final short SYNTHETIC
This flag is set on classes, methods and fields that were generated by the compiler and do not appear in the source code.- See Also:
- Constant Field Values
-
ANNOTATION
public static final short ANNOTATION
This flag is set on annotation types (including nested annotation types), and requires thatINTERFACEis also set.- See Also:
- Constant Field Values
-
ENUM
public static final short ENUM
This flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is mutually exclusive withINTERFACE.- See Also:
- Constant Field Values
-
-
Method Detail
-
isPublicAccess
public static boolean isPublicAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PUBLICaccessibility
-
isPrivateAccess
public static boolean isPrivateAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PRIVATEaccessibility
-
isProtectedAccess
public static boolean isProtectedAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PROTECTEDaccessibility
-
isPackageAccess
public static boolean isPackageAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PACKAGE(a.k.a. 'default') accessibility
-
changeAccess
public static short changeAccess(short modifiers, short newAccess)- Returns:
- The given modifiers, but with the accessibility part changed to newAccess
-
isStatic
public static boolean isStatic(short sh)
- Returns:
- Whether the given modifier includes
STATIC
-
isFinal
public static boolean isFinal(short sh)
- Returns:
- Whether the given modifier includes
INTERFACE
-
isSuper
public static boolean isSuper(short sh)
- Returns:
- Whether the given modifier includes
SUPER
-
isSynchronized
public static boolean isSynchronized(short sh)
- Returns:
- Whether the given modifier includes
SYNCHRONIZED
-
isVolatile
public static boolean isVolatile(short sh)
- Returns:
- Whether the given modifier includes
VOLATILE
-
isBridge
public static boolean isBridge(short sh)
- Returns:
- Whether the given modifier includes
BRIDGE
-
isTransient
public static boolean isTransient(short sh)
- Returns:
- Whether the given modifier includes
TRANSIENT
-
isVarargs
public static boolean isVarargs(short sh)
- Returns:
- Whether the given modifier includes
VARARGS
-
isNative
public static boolean isNative(short sh)
- Returns:
- Whether the given modifier includes
NATIVE
-
isInterface
public static boolean isInterface(short sh)
- Returns:
- Whether the given modifier includes
INTERFACE
-
isAbstract
public static boolean isAbstract(short sh)
- Returns:
- Whether the given modifier includes
ABSTRACT
-
isStrictfp
public static boolean isStrictfp(short sh)
- Returns:
- Whether the given modifier includes
STRICTFP
-
isSynthetic
public static boolean isSynthetic(short sh)
- Returns:
- Whether the given modifier includes
SYNTHETIC
-
isAnnotation
public static boolean isAnnotation(short sh)
- Returns:
- Whether the given modifier includes
ANNOTATION
-
isEnum
public static boolean isEnum(short sh)
- Returns:
- Whether the given modifier includes
ENUM
-
-