Eclipse JDT
Release 3.0

org.eclipse.jdt.core.dom
Class Modifier

java.lang.Object
  extended byorg.eclipse.jdt.core.dom.ASTNode
      extended byorg.eclipse.jdt.core.dom.Modifier
All Implemented Interfaces:
IExtendedModifier

public final class Modifier
extends ASTNode
implements IExtendedModifier

Modifier node.

 Modifier:
    public
    protected
    private
    static
    abstract
    final
    native
    synchronized
    transient
    volatile
    strictfp
 

The numeric values of these flags match the ones for class files as described in the Java Virtual Machine Specification. Note that Java model class Flags also provides the same constants as this class.

Since:
2.0

Nested Class Summary
static class Modifier.ModifierKeyword
          Modifier keywords (typesafe enumeration).
 
Field Summary
static int ABSTRACT
          "abstract" modifier constant (bit mask).
static int FINAL
          "final" modifier constant (bit mask).
static SimplePropertyDescriptor KEYWORD_PROPERTY
          The "keyword" structural property of this node type.
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).
 
Fields inherited from class org.eclipse.jdt.core.dom.ASTNode
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, DO_STATEMENT, EMPTY_STATEMENT, ENHANCED_FOR_STATEMENT, ENUM_CONSTANT_DECLARATION, ENUM_DECLARATION, EXPRESSION_STATEMENT, FIELD_ACCESS, FIELD_DECLARATION, FOR_STATEMENT, IF_STATEMENT, IMPORT_DECLARATION, INFIX_EXPRESSION, INITIALIZER, INSTANCEOF_EXPRESSION, JAVADOC, LABELED_STATEMENT, LINE_COMMENT, MALFORMED, MARKER_ANNOTATION, MEMBER_REF, MEMBER_VALUE_PAIR, METHOD_DECLARATION, METHOD_INVOCATION, METHOD_REF, METHOD_REF_PARAMETER, MODIFIER, NORMAL_ANNOTATION, NULL_LITERAL, NUMBER_LITERAL, ORIGINAL, PACKAGE_DECLARATION, PARAMETERIZED_TYPE, PARENTHESIZED_EXPRESSION, POSTFIX_EXPRESSION, PREFIX_EXPRESSION, PRIMITIVE_TYPE, PROTECT, QUALIFIED_NAME, QUALIFIED_TYPE, RETURN_STATEMENT, SIMPLE_NAME, SIMPLE_TYPE, SINGLE_MEMBER_ANNOTATION, SINGLE_VARIABLE_DECLARATION, STRING_LITERAL, SUPER_CONSTRUCTOR_INVOCATION, SUPER_FIELD_ACCESS, SUPER_METHOD_INVOCATION, SWITCH_CASE, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, TAG_ELEMENT, TEXT_ELEMENT, THIS_EXPRESSION, THROW_STATEMENT, TRY_STATEMENT, TYPE_DECLARATION, TYPE_DECLARATION_STATEMENT, TYPE_LITERAL, TYPE_PARAMETER, VARIABLE_DECLARATION_EXPRESSION, VARIABLE_DECLARATION_FRAGMENT, VARIABLE_DECLARATION_STATEMENT, WHILE_STATEMENT, WILDCARD_TYPE
 
Method Summary
 Modifier.ModifierKeyword getKeyword()
          Returns the modifier keyword of this modifier node.
static boolean isAbstract(int flags)
          Returns whether the given flags includes the "abstract" modifier.
 boolean isAnnotation()
          Returns whether this extended modifier is an annotation.
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.
static boolean isNative(int flags)
          Returns whether the given flags includes the "native" modifier.
static boolean isPrivate(int flags)
          Returns whether the given flags includes the "private" modifier.
static boolean isProtected(int flags)
          Returns whether the given flags includes the "protected" modifier.
static boolean isPublic(int flags)
          Returns whether the given flags includes the "public" modifier.
static boolean isStatic(int flags)
          Returns whether the given flags includes the "static" modifier.
static boolean isStrictfp(int flags)
          Returns whether the given flags includes the "strictfp" modifier.
static boolean isSynchronized(int flags)
          Returns whether the given flags includes the "synchronized" modifier.
static boolean isTransient(int flags)
          Returns whether the given flags includes the "transient" modifier.
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.
 
Methods inherited from class org.eclipse.jdt.core.dom.ASTNode
accept, copySubtree, copySubtrees, delete, equals, getAST, getFlags, getLength, getLocationInParent, getNodeType, getParent, getProperty, getRoot, getStartPosition, getStructuralProperty, nodeClassForType, properties, setFlags, setProperty, setSourceRange, setStructuralProperty, structuralPropertiesForType, subtreeBytes, subtreeMatch, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Modifier constant (bit mask, value 0) indicating no modifiers.

Since:
2.0
See Also:
Constant Field Values

PUBLIC

public static final int PUBLIC
"public" modifier constant (bit mask). Applicable to types, methods, constructors, and fields.

Since:
2.0
See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
"private" modifier constant (bit mask). Applicable to types, methods, constructors, and fields.

Since:
2.0
See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
"protected" modifier constant (bit mask). Applicable to types, methods, constructors, and fields.

Since:
2.0
See Also:
Constant Field Values

STATIC

public static final int STATIC
"static" modifier constant (bit mask). Applicable to types, methods, fields, and initializers.

Since:
2.0
See Also:
Constant Field Values

FINAL

public static final int FINAL
"final" modifier constant (bit mask). Applicable to types, methods, fields, and variables.

Since:
2.0
See Also:
Constant Field Values

SYNCHRONIZED

public static final int SYNCHRONIZED
"synchronized" modifier constant (bit mask). Applicable only to methods.

Since:
2.0
See Also:
Constant Field Values

VOLATILE

public static final int VOLATILE
"volatile" modifier constant (bit mask). Applicable only to fields.

Since:
2.0
See Also:
Constant Field Values

TRANSIENT

public static final int TRANSIENT
"transient" modifier constant (bit mask). Applicable only to fields.

Since:
2.0
See Also:
Constant Field Values

NATIVE

public static final int NATIVE
"native" modifier constant (bit mask). Applicable only to methods.

Since:
2.0
See Also:
Constant Field Values

ABSTRACT

public static final int ABSTRACT
"abstract" modifier constant (bit mask). Applicable to types and methods.

Since:
2.0
See Also:
Constant Field Values

STRICTFP

public static final int STRICTFP
"strictfp" modifier constant (bit mask). Applicable to types and methods.

Since:
2.0
See Also:
Constant Field Values

KEYWORD_PROPERTY

public static final SimplePropertyDescriptor KEYWORD_PROPERTY
The "keyword" structural property of this node type.

Since:
3.0
Method Detail

isPublic

public static boolean isPublic(int flags)
Returns whether the given flags includes the "public" modifier. Applicable to types, methods, constructors, and fields.

Parameters:
flags - the modifier flags
Returns:
true if the PUBLIC bit is set, and false otherwise
Since:
2.0

isPrivate

public static boolean isPrivate(int flags)
Returns whether the given flags includes the "private" modifier. Applicable to types, methods, constructors, and fields.

Parameters:
flags - the modifier flags
Returns:
true if the PRIVATE bit is set, and false otherwise
Since:
2.0

isProtected

public static boolean isProtected(int flags)
Returns whether the given flags includes the "protected" modifier. Applicable to types, methods, constructors, and fields.

Parameters:
flags - the modifier flags
Returns:
true if the PROTECTED bit is set, and false otherwise
Since:
2.0

isStatic

public static boolean isStatic(int flags)
Returns whether the given flags includes the "static" modifier. Applicable to types, methods, fields, and initializers.

Parameters:
flags - the modifier flags
Returns:
true if the STATIC bit is set, and false otherwise
Since:
2.0

isFinal

public static boolean isFinal(int flags)
Returns whether the given flags includes the "final" modifier. Applicable to types, methods, fields, and variables.

Parameters:
flags - the modifier flags
Returns:
true if the FINAL bit is set, and false otherwise
Since:
2.0

isSynchronized

public static boolean isSynchronized(int flags)
Returns whether the given flags includes the "synchronized" modifier. Applicable only to methods.

Parameters:
flags - the modifier flags
Returns:
true if the SYNCHRONIZED bit is set, and false otherwise
Since:
2.0

isVolatile

public static boolean isVolatile(int flags)
Returns whether the given flags includes the "volatile" modifier. Applicable only to fields.

Parameters:
flags - the modifier flags
Returns:
true if the VOLATILE bit is set, and false otherwise
Since:
2.0

isTransient

public static boolean isTransient(int flags)
Returns whether the given flags includes the "transient" modifier. Applicable only to fields.

Parameters:
flags - the modifier flags
Returns:
true if the TRANSIENT bit is set, and false otherwise
Since:
2.0

isNative

public static boolean isNative(int flags)
Returns whether the given flags includes the "native" modifier. Applicable only to methods.

Parameters:
flags - the modifier flags
Returns:
true if the NATIVE bit is set, and false otherwise
Since:
2.0

isAbstract

public static boolean isAbstract(int flags)
Returns whether the given flags includes the "abstract" modifier. Applicable to types and methods.

Parameters:
flags - the modifier flags
Returns:
true if the ABSTRACT bit is set, and false otherwise
Since:
2.0

isStrictfp

public static boolean isStrictfp(int flags)
Returns whether the given flags includes the "strictfp" modifier. Applicable to types and methods.

Parameters:
flags - the modifier flags
Returns:
true if the STRICTFP bit is set, and false otherwise
Since:
2.0

propertyDescriptors

public static List propertyDescriptors(int apiLevel)
Returns a list of structural property descriptors for this node type. Clients must not modify the result.

Parameters:
apiLevel - the API level; one of the AST.JLS* constants
Returns:
a list of property descriptors (element type: StructuralPropertyDescriptor)
Since:
3.0

isModifier

public boolean isModifier()
Description copied from interface: IExtendedModifier
Returns whether this extended modifier is a standard modifier.

Specified by:
isModifier in interface IExtendedModifier
Returns:
true if this is a standard modifier (instance of Modifier), and false otherwise
See Also:
IExtendedModifier.isModifier()

isAnnotation

public boolean isAnnotation()
Description copied from interface: IExtendedModifier
Returns whether this extended modifier is an annotation.

Specified by:
isAnnotation in interface IExtendedModifier
Returns:
true if this is an annotation (instance of a subclass of Annotation), and false otherwise
See Also:
IExtendedModifier.isAnnotation()

getKeyword

public Modifier.ModifierKeyword getKeyword()
Returns the modifier keyword of this modifier node.

Returns:
the modifier keyword
Since:
3.0

setKeyword

public void setKeyword(Modifier.ModifierKeyword modifierKeyord)
Sets the modifier keyword of this modifier node.

Parameters:
modifierKeyord - the modifier keyword
Throws:
IllegalArgumentException - if the argument is null
Since:
3.0

Eclipse JDT
Release 3.0

Copyright (c) IBM Corp. and others 2000, 2004. All Rights Reserved.