com.bowstreet.webapp
Interface Method

All Superinterfaces:
ClassItem, IExemplar, WebAppObject

public interface Method
extends WebAppObject, ClassItem

Class that represents a Java method in a WebApp.


Field Summary
 
Fields inherited from interface com.bowstreet.webapp.WebAppObject
ALWAYS_VISIBLE, INFORMATION_PROPERTY, NEVER_VISIBLE, SOMETIMES_VISIBLE
 
Method Summary
 void addArgument(java.lang.String name, java.lang.String type)
          Adds an input argument
 void addImport(java.lang.String importName)
          Adds an import statement
 void addLine(java.lang.String line)
          Helper method to add a line to the method body.
 void addThrows(java.lang.String name)
          Adds to the list of exceptions that are thrown by the method.
 java.util.Iterator getArguments()
          Gets list of arguments and their types.
 java.lang.String getBody()
          Get Java body for method.
 java.util.Iterator getImports()
          Gets list of import statements
 java.lang.String getModifier()
          Gets the method modifier.
 java.lang.String getReturnType()
          Gets return type
 java.lang.String getSchemaPath()
          Get schemaPath associated with a method that returns IXml (null if not XML)
 java.util.Iterator getThrows()
          Gets an Iterator of the exceptions that are thrown by the method.
 boolean isInterface()
          Gets if this Method is on an interface.
 void setBody(java.lang.String body)
          Sets Java body
 void setInterface(boolean isInterface)
          Sets if this Method is on an interface.
 void setModifier(java.lang.String modifier)
          Sets the method modifier.
 void setReturnType(java.lang.String type)
          Sets return type
 void setSchemaPath(java.lang.String schemaPath)
          Set the schemaPath for a method that returns IXml.
 
Methods inherited from interface com.bowstreet.webapp.WebAppObject
clone, getBuilderCall, getName, getProperties, getProperty, getVisibility, isHidden, putProperty, setBuilderCall, setHidden, setName, setVisibility
 
Methods inherited from interface com.bowstreet.util.IExemplar
newInstance
 
Methods inherited from interface com.bowstreet.webapp.ClassItem
getComment, isGenerated, setComment, setGenerated, write
 

Method Detail

addArgument

void addArgument(java.lang.String name,
                 java.lang.String type)
Adds an input argument

Parameters:
name - Name of argument
type - Classname/type of argument
Example:
Add a String argument
 method.addArgument("messageText", "String");

addImport

void addImport(java.lang.String importName)
Adds an import statement

Parameters:
importName - Name of class or package to import.

addLine

void addLine(java.lang.String line)
Helper method to add a line to the method body.

Parameters:
line - The lide to add to the method body.

addThrows

void addThrows(java.lang.String name)
Adds to the list of exceptions that are thrown by the method. Note - While this method is available to the Builders at generation time there is no support in the Factory WebApp runtime for generating artifacts related to it.

Parameters:
name - The name of the exception

getArguments

java.util.Iterator getArguments()
Gets list of arguments and their types. Returned type of objects in list is com.bowstreet.util.NameValuePair.


getBody

java.lang.String getBody()
Get Java body for method.

Returns:
Java body

getImports

java.util.Iterator getImports()
Gets list of import statements


getModifier

java.lang.String getModifier()
Gets the method modifier. Note - While this method is available to the Builders at generation time there is no support in the Factory WebApp runtime for generating artifacts related to it.

Specified by:
getModifier in interface ClassItem
Returns:
The method modifier.

getReturnType

java.lang.String getReturnType()
Gets return type

Returns:
Java type returned by method

getSchemaPath

java.lang.String getSchemaPath()
Get schemaPath associated with a method that returns IXml (null if not XML)

Returns:
schemaPath string, or null

getThrows

java.util.Iterator getThrows()
Gets an Iterator of the exceptions that are thrown by the method. Note - While this method is available to the Builders at generation time there is no support in the Factory WebApp runtime for generating artifacts related to it.

Returns:
An Iterator of the exceptions (as String) that are thrown by the method.

isInterface

boolean isInterface()
Gets if this Method is on an interface.

Returns:
true if this is an interface method, else false.

setBody

void setBody(java.lang.String body)
Sets Java body

Parameters:
body - Java method body
Example:
Create a method that simply returns an argument value:
 Method method = webApp.addMethod("sampleMethod");
 method.setReturnType("Object");
 method.addArgument("dataSource", "Object");
 method.setBody("{\nreturn dataSource;\n}");

setInterface

void setInterface(boolean isInterface)
Sets if this Method is on an interface.

Parameters:
isInterface - true if this is an interface method, else false.

setModifier

void setModifier(java.lang.String modifier)
Sets the method modifier. Note - While this method is available to the Builders at generation time there is no support in the Factory WebApp runtime for generating artifacts related to it.

Parameters:
modifier - The method modifier.

setReturnType

void setReturnType(java.lang.String type)
Sets return type

Parameters:
type - Java type returned by method
Example:
method.setReturnType("Object");

setSchemaPath

void setSchemaPath(java.lang.String schemaPath)
Set the schemaPath for a method that returns IXml.

Parameters:
schemaPath - string represenation (eg, "/" )


Copyright © 2009 IBM. All Rights Reserved.