com.togethersoft.openapi.sci
Interface SciInheritanceList


public interface SciInheritanceList
extends SciContainer

SciInheritanceList is a container of references to the exteded or implemented interfaces, or to the extended classes. An object of this type is returned by both SciClass.getExtendsList and SciClass.getImplementsList methods:

getText method returns a string containing the source code fragment with the names of classes/interfaces. For example, if class mySciClass stands for this source code class:


 public class Class1 extends somepackage.Class2 implements Interface1, somePackage.Interface2 {
   ...
 }
then the following code:
mySciClass.getExtendsList().getText()
will return "somepackage.Class2".
mySciClass.getImplementsList().getText()
will return "Interface1, somePackage.Interface2".

References to the classes/interfaces can be obtained via inheritances method. You can change the text of extends/implements section represented by this SciInheritanceList object using the setText method. For example, let's set the implements section to the "implements SciContainer, MyInterface":

 mySciClass.getImplementsList().setText("SciContainer, MyInterface");
 

Since this interface extends SciContainer, its paste method can be used to add new SciInheritances to this container. For example, consider this situation: you wish to make some class (represented by the someSciClass object) implement an interface represented by targetInterface object (instance of SciClass). This is how it can be done:

 SciInheritance newInheritance = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newInheritance();
 newInheritance.setReferencedElement(targetInterface);
 someSciClass.getImplementsList().paste(newInheritance, null, false);
 

Author:
TogetherSoft
See Also: SciInheritance, inheritances(), SciClass.getExtendsList(), SciClass.getImplementsList()

Method Summary
 booleancanSetText(String text)
           Checks whether the specified string containing the names of classes/interfaces can be put into the source code for this class (in the extends/implements section).
 StringgetText()
           Returns a string containing the source code fragment with the names of classes/interfaces.
 SciInheritanceEnumerationinheritances()
           Returns an enumeration of SciInheritance references to the classes/interfaces.
 voidsetText(String text)
           Puts the string containing the names of classes/interfaces into the source code for this class (in the extends/implements section).

Methods inherited from interface com.togethersoft.openapi.sci.SciContainer
canPaste, objects, paste

Method Detail

canSetText

public boolean canSetText(String text)
Checks whether the specified string containing the names of classes/interfaces can be put into the source code for this class (in the extends/implements section).
Returns: true if the specified string can be put into the source code for this class, false otherwise

getText

public String getText()
Returns a string containing the source code fragment with the names of classes/interfaces. See the desciption of this interface for an example. If this SciClass doesn't extends/implements anything, returns an empty string.
Returns: a string containing the source code fragment with the names classes/interfaces

inheritances

public SciInheritanceEnumeration inheritances()
Returns an enumeration of SciInheritance references to the classes/interfaces.
Returns: an enumeration of SciInheritance references to the classes/interfaces
See Also:
SciInheritance, SciReference

setText

public void setText(String text)
Puts the string containing the names of classes/interfaces into the source code for this class (in the extends/implements section).
Parameters:
text - the string containing the names of classes/interfaces