Class Mod
java.lang.Object
org.codehaus.janino.Mod
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
FieldsModifier and TypeFieldDescriptionstatic final shortThis flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive withFINAL,NATIVE,PRIVATE,STATICandSYNCHRONIZED.static final shortThis flag is set on annotation types (including nested annotation types), and requires thatINTERFACEis also set.static final shortThis flag is set on 'bridge methods' generated by the compiler.static final shortThis flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is mutually exclusive withINTERFACE.static final shortstatic final shortThis flag is set on interfaces (including nested interfaces), and requires thatABSTRACTmust also be set.static final shortThis flag is set on NATIVE methods, and is mutually exclusive withABSTRACT.static final shortAn alias for '0' -- no modifiers.static final shortThe flag indicating 'default accessibility' a.k.a.static final shortThe mask to select the accessibility flags from modifiers.static final shortThe flag indicating 'private accessibility' of the modified element.static final shortThe flag indicating 'protected accessibility' of the modified element.static final shortThe flag indicating 'public accessibility' of the modified element.static final shortThis flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC methods, and STATIC nested classes.static final shortThis flag is set on STRICTFP methods, and is mutually exclusive withABSTRACT.static final shortThis flag is always set on classes, and never set on any other element.static final shortThis flag is set on SYNCHRONIZED methods.static final shortThis flag is set on classes, methods and fields that were generated by the compiler and do not appear in the source code.static final shortThis flag is set on TRANSIENT fields.static final shortThis flag is set on 'variable arity' (a.k.a.static final shortThis flag is set on VOLATILE fields and is mutually exclusive withFINAL. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
NONE
public static final short NONEAn alias for '0' -- no modifiers.- See Also:
-
PUBLIC
public static final short PUBLICThe flag indicating 'public accessibility' of the modified element. Methods of interfaces are alwaysPUBLIC.- See Also:
-
PRIVATE
public static final short PRIVATEThe flag indicating 'private accessibility' of the modified element.- See Also:
-
PROTECTED
public static final short PROTECTEDThe flag indicating 'protected accessibility' of the modified element.- See Also:
-
PACKAGE
public static final short PACKAGEThe flag indicating 'default accessibility' a.k.a. 'package accessibility' of the modified element.- See Also:
-
PPP
public static final short PPPThe mask to select the accessibility flags from modifiers.- See Also:
-
STATIC
public static final short STATICThis flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC methods, and STATIC nested classes.- See Also:
-
FINAL
-
SUPER
public static final short SUPERThis 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:
-
SYNCHRONIZED
public static final short SYNCHRONIZEDThis flag is set on SYNCHRONIZED methods. Notice that it has the same value asSUPER, which is OK becauseSYNCHRONIZEDis for methods andSUPERfor classes.- See Also:
-
VOLATILE
-
BRIDGE
-
TRANSIENT
-
VARARGS
-
NATIVE
public static final short NATIVEThis flag is set on NATIVE methods, and is mutually exclusive withABSTRACT.- See Also:
-
INTERFACE
-
ABSTRACT
public static final short ABSTRACTThis flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive withFINAL,NATIVE,PRIVATE,STATICandSYNCHRONIZED.- See Also:
-
STRICTFP
public static final short STRICTFPThis flag is set on STRICTFP methods, and is mutually exclusive withABSTRACT.- See Also:
-
SYNTHETIC
public static final short SYNTHETICThis flag is set on classes, methods and fields that were generated by the compiler and do not appear in the source code.- See Also:
-
ANNOTATION
public static final short ANNOTATIONThis flag is set on annotation types (including nested annotation types), and requires thatINTERFACEis also set.- See Also:
-
ENUM
public static final short ENUMThis flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is mutually exclusive withINTERFACE.- See Also:
-
-
Constructor Details
-
Mod
private Mod()
-
-
Method Details
-
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
-