com.togethersoft.openapi.sci
Interface SciThrowList


public interface SciThrowList
extends SciContainer

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:

 public void someOperation throws java.io.IOException, java.lang.CloneNotSupportedException {
   ...
 }
you can do this:
 someSciOperation.getThrowList().setText("java.io.IOException, java.lang.CloneNotSupportedException");
 
Method 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);
 

Author:
TogetherSoft
See Also: SciThrowSpecifier, SciFactory.newThrowSpecifier()

Method Summary
 booleancanSetText(String text)
           Checks whether it is possible to put the string containing the names of exceptions into the source code for this class.
 StringgetText()
           Returns a string containing the source code fragment with the names of exceptions which can be thrown.
 voidsetText(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++).
 SciThrowSpecifierEnumerationthrowSpecifiers()
           Returns an enumeration of SciThrowSpecifier references to the exception classes.

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

Method Detail

canSetText

public 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.
Parameters:
text - the string containing the names of exceptions separated with commas
Returns: true if this can be done, false otherwise

getText

public String getText()
Returns a string containing the source code fragment with the names of exceptions which can be thrown. If this operation doesn't throw any exceptions, returns an empty string.
Returns: string
See Also:
setText(java.lang.String)

setText

public 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++).
Parameters:
text - the string containing the names of exceptions separated with commas
See Also:
getText()

throwSpecifiers

public SciThrowSpecifierEnumeration throwSpecifiers()
Returns an enumeration of SciThrowSpecifier references to the exception classes.
Returns: an enumeration of SciThrowSpecifier references to the exception classes
See Also:
SciThrowSpecifier