| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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:
getExtendsList for a class, it contains SciInheritances
which are references to the extended classes.
getExtendsList for an interface, it contains SciInheritances
which are references to the extended interfaces.
getImplementsList (it is non-null only for classes), it contains
SciInheritances which are references to the implemented interfaces.
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);
| Method Summary | |
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). |
String | getText()Returns a string containing the source code fragment with the names of classes/interfaces. |
SciInheritanceEnumeration | inheritances()Returns an enumeration of SciInheritance references to the classes/interfaces. |
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). |
| Methods inherited from interface com.togethersoft.openapi.sci.SciContainer |
canPaste, objects, paste |
| Method Detail |
public boolean canSetText(String text)
true if the specified string
can be put into the source code for this class, false otherwisepublic String getText()
SciClass doesn't extends/implements anything, returns an empty string.public SciInheritanceEnumeration inheritances()
SciInheritance references to the classes/interfaces.SciInheritance references to the classes/interfacespublic void setText(String text)
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||