Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.togethersoft.openapi.sci
Interface SciFunction

All Known Subinterfaces:
  SciOperation

public interface SciFunction
extends SciElement

A function in source code.

This interface provides a set of methods for accessing and changing this function's data such as its body, parameters list and return type.

Note that this inteface is extended by `SciOperation` interface, inheriting all its methods.

Author:
  TogetherSoft
See Also: SciOperation

Method Summary
`boolean` | `canSetBody(SciCodeBlock body)` Checks whether is it possible to set the body of this function to the specified code block value.
`boolean` | `canSetReturnType(SciType type)` Chechs whether the return type for this function can be set to the specified value.
`SciCodeBlock` | `getBody()` Returns code block with the body of this function.
`SciParameterList` | `getParameterList()` Returns a container with the parameters of this function.
`SciType` | `getReturnType()` Gets the return type for this function.
`SciThrowList` | `getThrowList()` Returns a container of exceptions which can be thrown by this function.
`void` | `setBody(SciCodeBlock body)` Sets the body of this function to the specified code block value.
`void` | `setReturnType(SciType type)` Sets the return type for this function to the specified value.

Methods inherited from interface com.togethersoft.openapi.sci.SciElement
`accept, canSetName, canSetProperty, getDeclarationText, getName, getQualifiedName, getTagList, getUniqueName, hasProperty, isDeleted, isPropertyReadable, isPropertyWritable, setName, setProperty, visitReferences, visitReferences`

Methods inherited from interface com.togethersoft.openapi.sci.SciObject
`canCut, canDelete, canReplace, copy, cut, delete, getContainingFile, getContainingScope, getLanguage, getPositions, getText, getUserProperty, isReadOnly, replace, setUserProperty`

Method Detail

### canSetBody

    public boolean canSetBody(SciCodeBlock body)

  Checks whether is it possible to set the body of this function to the specified code block value.
  Parameters:
    body - The `SciCodeBlock` containing a body for this function. Usually, it is created using the SciGenericFactory.newCodeBlock or SciFactory.newCodeBlock methods.
  Returns: `true` if the specified code block value can be set as a body for this function

### canSetReturnType

    public boolean canSetReturnType(SciType type)

  Chechs whether the return type for this function can be set to the specified value.
  Parameters:
    type - the `SciType` return type
  Returns: `true` if the specified return type for this function can be set to the specified value, `false` otherwise

### getBody

    public SciCodeBlock getBody()

  Returns code block with the body of this function.
  Returns: `SciCodeBlock` with the body of this function

### getParameterList

    public SciParameterList getParameterList()

  Returns a container with the parameters of this function.
  Returns: `SciParameterList` which contains `SciParameter`s for this function
  See Also:
    SciParameterList

### getReturnType

    public SciType getReturnType()

  Gets the return type for this function. Usually, the returned `SciType` object is used to get a string with the return type object. For example, for this function represented by `someSciFunction` `

       public lava.lang.Object getID(){ return null; }

  ` this line `

       String typeText = someSciFunction.getReturnType().getText();

  ` will assign `typeText` the "lava.lang.Object" value.
  Returns: the return type for this function
  See Also:
    SciType

### getThrowList

    public SciThrowList getThrowList()

  Returns a container of exceptions which can be thrown by this function.
  Returns: `SciThrowList` which contains `SciThrowSpecifier`s for this function.
  See Also:
    SciThrowList

### setBody

    public void setBody(SciCodeBlock body)

  Sets the body of this function to the specified code block value.
  Parameters:
    body - The `SciCodeBlock` containing a body for this function. Usually, it is created using the SciGenericFactory.newCodeBlock or SciFactory.newCodeBlock methods.

### setReturnType

    public void setReturnType(SciType type)

  Sets the return type for this function to the specified value. Usually it is easier just to change the text of the current `SciType` object representing the return type, than to create a new `SciType` object. To do that small trick, get the current return type, and change it using the setText method.

  For example, to change the return type of this operation represented by `someSciFunction` from ``

       public void String getID(){ return null; }

  to `

       public lava.lang.Object getID(){ return null; }

  ` you should do the following: `

       someSciFunction.getReturnType().setText("lava.lang.Object");

  `
  Parameters:
    type - the `SciType` return type

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD