Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.javatools.parser.java.v2.model
Interface SourceHasModifiers

All Superinterfaces:
Element, SourceElement
All Known Subinterfaces:
SourceCatchParameter, SourceClass, SourceClassInitializer, SourceEnumConstant, SourceFieldDeclaration, SourceFieldVariable, SourceFormalParameter, SourceImport, SourceLocalVariable, SourceLocalVariableDeclaration, SourceMember, SourceMemberVariable, SourceMethod, SourcePackage, SourceVariable, SourceVariableDeclaration

public interface SourceHasModifiers
extends SourceElement

A SourceElement that may have modifiers. Note that an annotation is considered a modifier.


Field Summary

 

Fields inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
CHILDREN_ALL, CHILDREN_BLANKLINES, CHILDREN_COMMENTS, CHILDREN_default, CHILDREN_none, CHILDREN_REGULAR, EMPTY_ARRAY, PRINT_ALL, REFORMAT_ALL, REFORMAT_INDENT

 

Method Summary
 void addModifiers(int modifiers)
          Adds the modifiers except for INTERFACE, ENUM, and ANNOTATION.
 int getModifiers()
          Gets the modifiers.
 java.util.List getSourceAnnotations()
          Gets the list of annotations.
 void removeModifiers(int modifiers)
          Removes the modifiers.
 void setModifiers(int modifiers)
          Sets the modifiers except for INTERFACE, ENUM, and ANNOTATION.

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
addSelf, addSelf, addSelfAfter, addSelfBefore, clearBinding, cloneSelf, compile, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getEndOffset, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelf

 

Method Detail

getModifiers

int getModifiers()
Gets the modifiers. Right now, this returns the effective modifiers rather than the raw modifiers.
Returns:
The modifiers associated with this object.

addModifiers

void addModifiers(int modifiers)
Adds the modifiers except for INTERFACE, ENUM, and ANNOTATION. To make a method a varargs method: - create the method - add all the parameters - use method.addModifiers( JavaConstants.ACC_VARARGS ) - this will make 'method' into a varargs method and turn the last parameter of method into a varargs parameter; it is up to the caller to make sure there is at least one parameter - adding more parameters when 'method' is already a varargs method will not work correctly; instead, use method.removeModifiers first to remove the ACC_VARARGS modifier, add the new parameter(s), and then add the ACC_VARARGS modifier again
Parameters:
modifiers - Valid values come from JavaConstants.ACC_* and are determined on a per-node basis.

The following modifiers are always ignored: ACC_INTERFACE, ACC_ENUM, ACC_ANNOTATION. In order to set them, you must use the special setter SourceClass.setTypeKind(I).

Throws:
java.lang.UnsupportedOperationException - if this operation is illegal.

setModifiers

void setModifiers(int modifiers)
Sets the modifiers except for INTERFACE, ENUM, and ANNOTATION. See the notes in addModifiers and removeModifiers about how they apply to methods.
Parameters:
modifiers - Valid values come from JavaConstants.ACC_* and are determined on a per-node basis.

The following modifiers are always ignored: ACC_INTERFACE, ACC_ENUM, ACC_ANNOTATION. In order to set them, you must use the special setter SourceClass.setTypeKind(I).

Throws:
java.lang.UnsupportedOperationException - if this operation is illegal.

removeModifiers

void removeModifiers(int modifiers)
Removes the modifiers. Calling method.removeModifiers( JavaConstants.ACC_VARARGS ) on a varargs method will turn that method into a non-varargs method and it will turn the last parameter, if any, into a non-varargs parameter
Parameters:
modifiers - Valid values come from JavaConstants.ACC_* and are determined on a per-node basis.
Throws:
java.lang.UnsupportedOperationException - if this operation is illegal.

getSourceAnnotations

java.util.List getSourceAnnotations()
Gets the list of annotations.
Returns:
The array of annotations on this object. Returns a collection of SourceAnnotation's.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


Copyright © 1997, 2013, Oracle. All rights reserved.