| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
SciInheritanceList is a container of references to the
extended 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
getExtendsList for an interface, it contains SciInheritances
getImplementsList (it is non-null only for classes), it contains
SciInheritances which are references to the implemented interfaces.
The getText method returns a string containing the source code fragment with
the names of classes/interfaces. For example, if the class mySciClass
stands for this source code class:
public class Class1 extends somepackage.Class2 implements Interface1, somePackage.Interface2 {
...
}
mySciClass.getExtendsList().getText() will return "somepackage.Class2".
mySciClass.getImplementsList().getText() will return "Interface1, somePackage.Interface2".
References to the classes/interfaces can be obtained using the
inheritances method.
You can change the text of the extends or implements sections represented by this SciInheritanceList
object using the setText method. For example, let's set the implements
section to "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 want to make some class (represented by the someSciClass object)
implement an interface represented by the 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 or 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
false otherwisepublic String getText()
SciClass doesn't extend or implement anything, it 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 | |||||||||