| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A generic element of a program (class, function, variable,
and so on).
Each SCI
element has a set of characteristics that define its behavior and structure:
SciClasses and
SciMembers, and contains the full name of the element.
You can identify a class by its qualified name if you know its language. For example:
SciClass justFoundClass = mySciModel.findClass(SciLanguage.JAVA,"com.togethersoft.openapi.sci.SciElement");
Every derivative of an SciElement inherits the accept(SciElementVisitor) method, which
runs a visitor's visitXXX method corresponding to the kind of element.
visitReferences(SciReferenceVisitor) and
visitReferences(SciReferenceVisitor, SciElement) methods are used to perform
actions on references contained in this element.
These interfaces contain a very useful method getTagList, which gives access to the
SciTag objects representing RWI properties of this element, written in Javadoc
style in the comment field.
The isDeleted method is used for checking whether this SciElement
represents an existing element of the model.
| Method Summary | |
Object | accept(SciElementVisitor visitor)"Accepts" a visitor, calling up its visitXXX method corresponding to the kind of element. |
boolean | canSetName(String name)Checks whether the specified name can be set for this element. |
boolean | canSetProperty(int property, boolean value)Checks if the value is valid for this property, or can be assigned to it at this time. |
String | getDeclarationText()Returns a string with a text of this element's declaration. |
String | getName()Returns a string containing the name for this element. |
String | getQualifiedName()Returns a string with the qualified name of this element. |
SciTagList | getTagList()Returns SciTagList object containing all SciTags for this element. |
String | getUniqueName()Returns a string with the unique name of this element. |
boolean | hasProperty(int property)Checks whether this element has the specified property. |
boolean | isDeleted()Checks whether this SciElement represents existing model data. |
boolean | isPropertyReadable(int property)Checks whether the property is readable (used to check whether the property has a sense for this element). |
boolean | isPropertyWritable(int property)Checks whether the property is writable for this element. |
void | setName(String name)Sets the name for this element. |
void | setProperty(int property, boolean value)Sets the value for the property. |
void | visitReferences(SciReferenceVisitor visitor)In this element, makes a specified visitor perform certain actions on all references. |
void | visitReferences(SciReferenceVisitor visitor, SciElement referencedElement)In this element, makes a specified visitor perform certain actions on all references to the specified element. |
| Methods inherited from interface com.togethersoft.openapi.sci.SciObject |
canCut, canDelete, canReplace, copy, cut, delete, getContainingFile, getContainingScope, getLanguage, getPositions, getText, getUserProperty, isReadOnly, replace, setUserProperty |
| Method Detail |
public Object accept(SciElementVisitor visitor)
visitXXX method corresponding to the kind of element.SciElementVisitor type visitorpublic boolean canSetName(String name)
true if the specified name can be set for this element, false otherwisepublic boolean canSetProperty(int property, boolean value)
SciProperty interface for predefined kinds of properties.true if the value can be assigned to the property, false otherwisepublic String getDeclarationText()
SciMember
/**
* @author TogetherSoft Corporation
*/
public void someOperation(String str){
System.out.println(str);
}
"public void someOperation(String str)".public String getName()
public String getQualifiedName()
SciClass the qualified name is a fully qualified name of this class.
For SciMembers this method returns a string written in Together's internal format.
To obtain a normal string with the member's qualified name, the method
SciLanguageHelper.convertMemberQualifiedNameToPresentableForm
can be used.
public SciTagList getTagList()
SciTagList object containing all SciTags for this element.
SciTag with the name null provides access to the description part of the comment.SciTagList object containing all SciTags for this elementpublic String getUniqueName()
public boolean hasProperty(int property)
true if it does,
false otherwise.SciProperty interface for predefined kinds of properties.true if this element has the specified property, false otherwise.
For example, suppose we have SciClass. SciClass might represent either a
class or an interface. Here is how we can distinguish them:
if (someSciClass.hasProperty(SciProperty.INTERFACE)){
... // it is an interface
} else {
... // it is a class
}
Another example: suppose you have SciOperation and you need to know if it is a
public abstract operation:
if (someSciOperation.hasProperty(SciProperty.PUBLIC) && someSciOperation.hasProperty(SciProperty.ABSTRACT)){
... // it is a public abstract operation
} else {
... // it is something else, not public abstract
}
public boolean isDeleted()
SciElement represents existing model data. For example, if you have gotten
SciElement representing an operation, and after that (while your script or pattern was
SciObject
SciObject.delete method, or the user just
SciElement
If you try to use methods of a deleted SciElement, the result is unpredictable
(you might get a NullPointerException, and so on). You should always check whether
SciElement is deleted, if you are not sure about it:
if (!mySciElement.isDeleted()) {
return mySciElement.getPositions();
}
Since Together version 5.1, implementation of SciClass was changed in order to return last valid
value at calls to SciObject.getLanguage(), SciElement.getQualifiedName(),
SciElement().getUniqueName() when isDeleted() returns true.
The only exception is methods equals and hashCode which can be performed
on deleted elements as well.
true if this SciElement represents a non-existing model element
false otherwisepublic boolean isPropertyReadable(int property)
SciProperty interface for predefined kinds of properties.true if the property is readable, false otherwisepublic boolean isPropertyWritable(int property)
SciProperty interface for predefined kinds of properties.true if the property is writable, false otherwisepublic void setName(String name)
public void setProperty(int property, boolean value)
SciProperty interface for predefined kinds of properties.
For example, if you have SciOperation representing a public operation and you would like
to make it private:
if (someSciOperation.canSetProperty(SciProperty.PRIVATE, true)){
someSciOperation.setProperty(SciProperty.PRIVATE, true); //do it
}
public void visitReferences(SciReferenceVisitor visitor)
SciReferenceVisitor which will perform certain actions
public void visitReferences(SciReferenceVisitor visitor, SciElement referencedElement)
SciReferenceVisitor which will perform certain actions
SciElement, references to which are subject to the actions
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||