public final class Modifier extends ASTNode implements IExtendedModifier
Modifier: public protected private static abstract final native synchronized transient volatile strictfp default
The numeric values of these flags match the ones for class
files as described in the Java Virtual Machine Specification
(except for DEFAULT
). Note that the Java model class
Flags
also provides the same
constants as this class.
Modifier and Type | Class and Description |
---|---|
static class |
Modifier.ModifierKeyword
Modifier keywords (typesafe enumeration).
|
Modifier and Type | Field and Description |
---|---|
static int |
ABSTRACT
"abstract" modifier constant (bit mask).
|
static int |
DEFAULT
"default" modifier constant (bit mask) (added in JLS8 API).
|
static int |
FINAL
"final" modifier constant (bit mask).
|
static SimplePropertyDescriptor |
KEYWORD_PROPERTY
The "keyword" structural property of this node type (type:
Modifier.ModifierKeyword ). |
static int |
NATIVE
"native" modifier constant (bit mask).
|
static int |
NONE
Modifier constant (bit mask, value 0) indicating no modifiers.
|
static int |
PRIVATE
"private" modifier constant (bit mask).
|
static int |
PROTECTED
"protected" modifier constant (bit mask).
|
static int |
PUBLIC
"public" modifier constant (bit mask).
|
static int |
STATIC
"static" modifier constant (bit mask).
|
static int |
STRICTFP
"strictfp" modifier constant (bit mask).
|
static int |
SYNCHRONIZED
"synchronized" modifier constant (bit mask).
|
static int |
TRANSIENT
"transient" modifier constant (bit mask).
|
static int |
VOLATILE
"volatile" modifier constant (bit mask).
|
ANNOTATION_TYPE_DECLARATION, ANNOTATION_TYPE_MEMBER_DECLARATION, ANONYMOUS_CLASS_DECLARATION, ARRAY_ACCESS, ARRAY_CREATION, ARRAY_INITIALIZER, ARRAY_TYPE, ASSERT_STATEMENT, ASSIGNMENT, BLOCK, BLOCK_COMMENT, BOOLEAN_LITERAL, BREAK_STATEMENT, CAST_EXPRESSION, CATCH_CLAUSE, CHARACTER_LITERAL, CLASS_INSTANCE_CREATION, COMPILATION_UNIT, CONDITIONAL_EXPRESSION, CONSTRUCTOR_INVOCATION, CONTINUE_STATEMENT, CREATION_REFERENCE, DIMENSION, DO_STATEMENT, EMPTY_STATEMENT, ENHANCED_FOR_STATEMENT, ENUM_CONSTANT_DECLARATION, ENUM_DECLARATION, EXPRESSION_METHOD_REFERENCE, EXPRESSION_STATEMENT, FIELD_ACCESS, FIELD_DECLARATION, FOR_STATEMENT, IF_STATEMENT, IMPORT_DECLARATION, INFIX_EXPRESSION, INITIALIZER, INSTANCEOF_EXPRESSION, INTERSECTION_TYPE, JAVADOC, LABELED_STATEMENT, LAMBDA_EXPRESSION, LINE_COMMENT, MALFORMED, MARKER_ANNOTATION, MEMBER_REF, MEMBER_VALUE_PAIR, METHOD_DECLARATION, METHOD_INVOCATION, METHOD_REF, METHOD_REF_PARAMETER, MODIFIER, NAME_QUALIFIED_TYPE, NORMAL_ANNOTATION, NULL_LITERAL, NUMBER_LITERAL, ORIGINAL, PACKAGE_DECLARATION, PARAMETERIZED_TYPE, PARENTHESIZED_EXPRESSION, POSTFIX_EXPRESSION, PREFIX_EXPRESSION, PRIMITIVE_TYPE, PROTECT, QUALIFIED_NAME, QUALIFIED_TYPE, RECOVERED, RETURN_STATEMENT, SIMPLE_NAME, SIMPLE_TYPE, SINGLE_MEMBER_ANNOTATION, SINGLE_VARIABLE_DECLARATION, STRING_LITERAL, SUPER_CONSTRUCTOR_INVOCATION, SUPER_FIELD_ACCESS, SUPER_METHOD_INVOCATION, SUPER_METHOD_REFERENCE, SWITCH_CASE, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, TAG_ELEMENT, TEXT_ELEMENT, THIS_EXPRESSION, THROW_STATEMENT, TRY_STATEMENT, TYPE_DECLARATION, TYPE_DECLARATION_STATEMENT, TYPE_LITERAL, TYPE_METHOD_REFERENCE, TYPE_PARAMETER, UNION_TYPE, VARIABLE_DECLARATION_EXPRESSION, VARIABLE_DECLARATION_FRAGMENT, VARIABLE_DECLARATION_STATEMENT, WHILE_STATEMENT, WILDCARD_TYPE
Modifier and Type | Method and Description |
---|---|
Modifier.ModifierKeyword |
getKeyword()
Returns the modifier keyword of this modifier node.
|
boolean |
isAbstract()
Answer true if the receiver is the abstract modifier, false otherwise.
|
static boolean |
isAbstract(int flags)
Returns whether the given flags includes the "abstract" modifier.
|
boolean |
isAnnotation()
Returns whether this extended modifier is an annotation.
|
boolean |
isDefault()
Answer true if the receiver is the default modifier, false otherwise.
|
static boolean |
isDefault(int flags)
Returns whether the given flags includes the "default" modifier.
|
boolean |
isFinal()
Answer true if the receiver is the final modifier, false otherwise.
|
static boolean |
isFinal(int flags)
Returns whether the given flags includes the "final" modifier.
|
boolean |
isModifier()
Returns whether this extended modifier is a standard modifier.
|
boolean |
isNative()
Answer true if the receiver is the native modifier, false otherwise.
|
static boolean |
isNative(int flags)
Returns whether the given flags includes the "native" modifier.
|
boolean |
isPrivate()
Answer true if the receiver is the private modifier, false otherwise.
|
static boolean |
isPrivate(int flags)
Returns whether the given flags includes the "private" modifier.
|
boolean |
isProtected()
Answer true if the receiver is the protected modifier, false otherwise.
|
static boolean |
isProtected(int flags)
Returns whether the given flags includes the "protected" modifier.
|
boolean |
isPublic()
Answer true if the receiver is the public modifier, false otherwise.
|
static boolean |
isPublic(int flags)
Returns whether the given flags includes the "public" modifier.
|
boolean |
isStatic()
Answer true if the receiver is the static modifier, false otherwise.
|
static boolean |
isStatic(int flags)
Returns whether the given flags includes the "static" modifier.
|
boolean |
isStrictfp()
Answer true if the receiver is the strictfp modifier, false otherwise.
|
static boolean |
isStrictfp(int flags)
Returns whether the given flags includes the "strictfp" modifier.
|
boolean |
isSynchronized()
Answer true if the receiver is the synchronized modifier, false otherwise.
|
static boolean |
isSynchronized(int flags)
Returns whether the given flags includes the "synchronized" modifier.
|
boolean |
isTransient()
Answer true if the receiver is the transient modifier, false otherwise.
|
static boolean |
isTransient(int flags)
Returns whether the given flags includes the "transient" modifier.
|
boolean |
isVolatile()
Answer true if the receiver is the volatile modifier, false otherwise.
|
static boolean |
isVolatile(int flags)
Returns whether the given flags includes the "volatile" modifier.
|
static List |
propertyDescriptors(int apiLevel)
Returns a list of structural property descriptors for this node type.
|
void |
setKeyword(Modifier.ModifierKeyword modifierKeyord)
Sets the modifier keyword of this modifier node.
|
accept, copySubtree, copySubtrees, delete, equals, getAST, getFlags, getLength, getLocationInParent, getNodeType, getParent, getProperty, getRoot, getStartPosition, getStructuralProperty, hashCode, nodeClassForType, properties, setFlags, setProperty, setSourceRange, setStructuralProperty, structuralPropertiesForType, subtreeBytes, subtreeMatch, toString
public static final int ABSTRACT
public static final int FINAL
public static final SimplePropertyDescriptor KEYWORD_PROPERTY
Modifier.ModifierKeyword
).public static final int NATIVE
public static final int NONE
public static final int PRIVATE
public static final int PROTECTED
public static final int PUBLIC
public static final int STATIC
public static final int STRICTFP
public static final int SYNCHRONIZED
public static final int TRANSIENT
public static final int VOLATILE
public static final int DEFAULT
Note that the value of this flag is internal and is not specified in the Java Virtual Machine Specification.
public static boolean isAbstract(int flags)
flags
- the modifier flagstrue
if the ABSTRACT
bit is
set, and false
otherwisepublic static boolean isFinal(int flags)
flags
- the modifier flagstrue
if the FINAL
bit is
set, and false
otherwisepublic static boolean isNative(int flags)
flags
- the modifier flagstrue
if the NATIVE
bit is
set, and false
otherwisepublic static boolean isPrivate(int flags)
flags
- the modifier flagstrue
if the PRIVATE
bit is
set, and false
otherwisepublic static boolean isProtected(int flags)
flags
- the modifier flagstrue
if the PROTECTED
bit is
set, and false
otherwisepublic static boolean isPublic(int flags)
flags
- the modifier flagstrue
if the PUBLIC
bit is
set, and false
otherwisepublic static boolean isStatic(int flags)
flags
- the modifier flagstrue
if the STATIC
bit is
set, and false
otherwisepublic static boolean isStrictfp(int flags)
flags
- the modifier flagstrue
if the STRICTFP
bit is
set, and false
otherwisepublic static boolean isSynchronized(int flags)
flags
- the modifier flagstrue
if the SYNCHRONIZED
bit is
set, and false
otherwisepublic static boolean isTransient(int flags)
flags
- the modifier flagstrue
if the TRANSIENT
bit is
set, and false
otherwisepublic static boolean isVolatile(int flags)
flags
- the modifier flagstrue
if the VOLATILE
bit is
set, and false
otherwisepublic static boolean isDefault(int flags)
flags
- the modifier flagstrue
if the DEFAULT
bit is set
and false
otherwisepublic static List propertyDescriptors(int apiLevel)
apiLevel
- the API level; one of the
AST.JLS*
constantsStructuralPropertyDescriptor
)public Modifier.ModifierKeyword getKeyword()
public boolean isAbstract()
public boolean isAnnotation()
IExtendedModifier
isAnnotation
in interface IExtendedModifier
true
if this is an annotation
(instance of a subclass of Annotation
), and
false
otherwiseIExtendedModifier.isAnnotation()
public boolean isFinal()
public boolean isModifier()
IExtendedModifier
isModifier
in interface IExtendedModifier
true
if this is a standard modifier
(instance of Modifier
), and false
otherwiseIExtendedModifier.isModifier()
public boolean isNative()
public boolean isPrivate()
public boolean isProtected()
public boolean isPublic()
public boolean isStatic()
public boolean isStrictfp()
public boolean isSynchronized()
public boolean isTransient()
public boolean isVolatile()
public boolean isDefault()
public void setKeyword(Modifier.ModifierKeyword modifierKeyord)
modifierKeyord
- the modifier keywordIllegalArgumentException
- if the argument is null
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.