com.togethersoft.openapi.sci
Interface SciType

All Known Subinterfaces:
SciTypeExpression

public interface SciType
extends SciReference

A reference to a type. This interface inherits all methods from SciRefernce for accessing to the referenced element and adds some methods for getting detailed information about this reference to type.

getCanonicalText method returns a string of a special kind. This string is called a canonical text. It contains the name of a referenced type in a special form which is the same for all the references to that type. For example, in the following source code there is a group of references to a MyColor type contained in the mulder.utils package :


  import mulder.utils.MyColor;
  ...
  MyColor[] myArray1;
   //SciReference.getReferenceText() returns "MyColor"

  mulder.utils.MyColor[ ] myArray2;
   //SciReference.getReferenceText() returns "mulder.utils.MyColor"
 
 
The getReferenceText method from SciReference interface will return different strings for these references, while getCanonicalText method will return the same string for both of them so they can be compared later and identified as references to the same type.

Author:
TogetherSoft
See Also: SciReference, SciReference.getReferenceText(), getCanonicalText()

Method Summary
 booleancanSetText(String text)
           Checks whether the specified string can be set as a text of this reference to a type.
 StringgetCanonicalText()
           Returns a canonical text string for this reference to a type.
 voidsetText(String text)
           In this reference to a type, sets the text of a type to the specified string.

Methods inherited from interface com.togethersoft.openapi.sci.SciReference
canSetReferencedElement, canSetReferenceText, getReferencedElement, getReferenceText, setReferencedElement, setReferenceText

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

canSetText

public boolean canSetText(String text)
Checks whether the specified string can be set as a text of this reference to a type.
Parameters:
text - the string which needs to be set as a text of this reference to a type
Returns: true if the specified string can be set as a text for this reference to a type, false otherwise

getCanonicalText

public String getCanonicalText()
Returns a canonical text string for this reference to a type. See this interface description for an example.
Returns: a canonical text string
See Also:
SciReference.getReferenceText()

setText

public void setText(String text)
In this reference to a type, sets the text of a type to the specified string. Note the difference with the SciReference.setReferenceText method. For example, if myTypeRef is a reference to the type mulder.utils.MyColor[] then for the following code :
 
    mulder.utils.MyColor[] myArray1;  
execution of
 
    myTypeRef.setReferenceText("scully.utils.HerColor"); 
will transform this into
 
    scully.utils.HerColor[] myArray1; //type is still an array (of HerColor)
  
but the execution of
 
    myTypeRef.setText("int"); 
will transform the original line into
 
    int myArray1;  
Parameters:
text - the string which needs to be set as a text for this reference to a type