| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Represenets a container of SciThrowSpecifiers, and provides a set of methods for
working with them.
getText method returns a string containing the source code fragment with
the names of exceptions which can be thrown. For example, if operation someSciOperation
stands for for this source code operation:
public void someOperation throws com.togethersoft.util.exception.CastNotSupportedException {
...
}
then the following code:
someSciOperataion.getThrowList().getText();
will return "com.togethersoft.util.exception.CastNotSupportedException".
To change the list of exceptions, you can use the setText method. For example,
to change someOperation to this:
you can do this:
public void someOperation throws java.io.IOException, java.lang.CloneNotSupportedException {
...
}
Method
someSciOperation.getThrowList().setText("java.io.IOException, java.lang.CloneNotSupportedException");
throwSpecifiers returns an enumeration of SciThrowSpecifiers. Normally
you would work with SciThrowSpecifiers directly only when you need to set the referenced element
for a newly created SciThrowSpecifier (see below).
Since this interface extends SciContainer, its paste
method can be used to add new SciThrowSpecifiers to this container. For example, consider
this situation: SciClass object named exceptionClass represents some exception
you would like to add to the list of exceptions of someSciOperation.
This is how it can be done:
SciThrowSpecifier newThrowSpec = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newThrowSpecifier();
newThrowSpec.setReferencedElement(exceptionClass);
someSciOperation.getThrowList().paste(newThrowSpec, null, false);
| Method Summary | |
boolean | canSetText(String text)Checks whether it is possible to put the string containing the names of exceptions into the source code for this class. |
String | getText()Returns a string containing the source code fragment with the names of exceptions which can be thrown. |
void | setText(String text)Puts the string containing the names of exceptions into the source code for this class after the "throws" keyword (Java) or in the "throw()" exception specification (C++). |
SciThrowSpecifierEnumeration | throwSpecifiers()Returns an enumeration of SciThrowSpecifier references to the exception classes. |
| Methods inherited from interface com.togethersoft.openapi.sci.SciContainer |
canPaste, objects, paste |
| Method Detail |
public boolean canSetText(String text)
true if this can be done, false otherwisepublic String getText()
public void setText(String text)
public SciThrowSpecifierEnumeration throwSpecifiers()
SciThrowSpecifier references to the exception classes.SciThrowSpecifier references to the exception classes
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||