| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
SciReference interface provides methods for working with references.
In SCI model references are:
For example, in the following Java source code fragment the references are
MyType1, someObject, someMethod and iTotal
(in the line with iTotal=1;):
MyType1 myFirstAttribute=null;
MyType2 mySecondAttribure=null;
int iTotal=0; // it is not a reference!
someObject.someMethod();
iTotal=1;
The referenced element can be obtained using getReferencedElement method.
It is possible
to change referenced element using setReferencedElement method. For the example described above
, if the refToMyType2 is a reference to MyType2, and the
elementMyType1 is an SCI element representing MyType1, the code:
refToType2.setReferencedElement(elementMyType1)
will make the following changes in the source code:
MyType1 myFirstAttribute=null;
MyType1 mySecondAttribure=null;
...
| Method Summary | |
boolean | canSetReferencedElement(SciElement element)Checks whether the specified element can be set as a target for this reference. |
boolean | canSetReferenceText(String text)Checks whether the specified text can be set as the text for this reference. |
SciElement | getReferencedElement()Returns an SciElement this reference points to. |
String | getReferenceText()Returns a string containing this reference text in a source code. |
void | setReferencedElement(SciElement element)Sets another SciElement for this reference to point to. |
void | setReferenceText(String text)Sets this reference text to the specified value. |
| 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 boolean canSetReferencedElement(SciElement element)
SciElement which needs to be set as a target for this referencetrue if the specified element can be set as a target for this reference,
false otherwisepublic boolean canSetReferenceText(String text)
true if the specified text can be set as the text for this reference,
false otherwisepublic SciElement getReferencedElement()
SciElement this reference points to. If Together cannot find such an element
(for example, file is not in the classpath), then returns null.SciElement this reference points topublic String getReferenceText()
public void setReferencedElement(SciElement element)
SciElement for this reference to point to.SciElement which needs to be set as a target for this referencepublic void setReferenceText(String text)
setReferencedElement method.
Note the difference with SciType.setText
method when working with the SciType objects (SciType is a special kind
of a reference - a reference to a type).
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||