Package org.codehaus.janino
Class Mod
- java.lang.Object
-
- org.codehaus.janino.Mod
-
public final class Mod extends java.lang.Object
This 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 short
ABSTRACT
This flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive withFINAL
,NATIVE
,PRIVATE
,STATIC
andSYNCHRONIZED
.static short
ANNOTATION
This flag is set on annotation types (including nested annotation types), and requires thatINTERFACE
is also set.static short
BRIDGE
This flag is set on 'bridge methods' generated by the compiler.static short
ENUM
This flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is mutually exclusive withINTERFACE
.static short
FINAL
static short
INTERFACE
This flag is set on interfaces (including nested interfaces), and requires thatABSTRACT
must also be set.static short
NATIVE
This flag is set on NATIVE methods, and is mutually exclusive withABSTRACT
.static short
NONE
An alias for '0' -- no modifiers.static short
PACKAGE
The flag indicating 'default accessibility' a.k.a.static short
PPP
The mask to select the accessibility flags from modifiers.static short
PRIVATE
The flag indicating 'private accessibility' of the modified element.static short
PROTECTED
The flag indicating 'protected accessibility' of the modified element.static short
PUBLIC
The flag indicating 'public accessibility' of the modified element.static short
STATIC
This flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC methods, and STATIC nested classes.static short
STRICTFP
This flag is set on STRICTFP methods, and is mutually exclusive withABSTRACT
.static short
SUPER
This flag is always set on classes, and never set on any other element.static short
SYNCHRONIZED
This flag is set on SYNCHRONIZED methods.static 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.static short
TRANSIENT
This flag is set on TRANSIENT fields.static short
VARARGS
This flag is set on 'variable arity' (a.k.a.static short
VOLATILE
This flag is set on VOLATILE fields and is mutually exclusive withFINAL
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static short
changeAccess(short modifiers, short newAccess)
static boolean
isAbstract(short sh)
static boolean
isAnnotation(short sh)
static boolean
isBridge(short sh)
static boolean
isEnum(short sh)
static boolean
isFinal(short sh)
static boolean
isInterface(short sh)
static boolean
isNative(short sh)
static boolean
isPackageAccess(short sh)
static boolean
isPrivateAccess(short sh)
static boolean
isProtectedAccess(short sh)
static boolean
isPublicAccess(short sh)
static boolean
isStatic(short sh)
static boolean
isStrictfp(short sh)
static boolean
isSuper(short sh)
static boolean
isSynchronized(short sh)
static boolean
isSynthetic(short sh)
static boolean
isTransient(short sh)
static boolean
isVarargs(short sh)
static boolean
isVolatile(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 withVOLATILE
andABSTRACT
.- 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 becauseSYNCHRONIZED
is for methods andSUPER
for 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 becauseSYNCHRONIZED
is for methods andSUPER
for 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 becauseBRIDGE
is for methods andVOLATILE
for 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 becauseBRIDGE
is for methods andVOLATILE
for 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 becauseVARARGS
is for methods andTRANSIENT
for 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 becauseVARARGS
is for methods andTRANSIENT
for 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 thatABSTRACT
must also be set.INTERFACE
is mutually exclusive withFINAL
,SUPER
andENUM
.- 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
,STATIC
andSYNCHRONIZED
.- 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 thatINTERFACE
is 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
PUBLIC
accessibility
-
isPrivateAccess
public static boolean isPrivateAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PRIVATE
accessibility
-
isProtectedAccess
public static boolean isProtectedAccess(short sh)
- Returns:
- Whether the given modifier symbolizes
PROTECTED
accessibility
-
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
-
-