uk.co.badgersinfoil.metaas.dom
Interface FunctionCommon

All Known Subinterfaces:
ASFunctionExpression, ASMethod

public interface FunctionCommon

Common interface for ASMethod and ASFunctionExpression.


Method Summary
 ASArg addParam(java.lang.String name, java.lang.String type)
          Adds a formal parameter to the list of parameters supported by this ActionScript method.
 ASArg addRestParam(java.lang.String name)
          Adds a 'rest' parameter to the list of parameters supported by this ActionScript method.
 java.util.List getArgs()
          Returns a list of the formal arguments accepted by this ActionScript method.
 java.lang.String getType()
          Returns the name of the return type of this ActionScript method, or null if it is untyped.
 ASArg removeParam(java.lang.String string)
          Removes the named parameter from this ActionScript methods formal parameter list.
 void setType(java.lang.String string)
          Defines the name of the type of object returned by this ActionScript method.
 

Method Detail

getArgs

java.util.List getArgs()
Returns a list of the formal arguments accepted by this ActionScript method. Note that the resulting list is not modifiable.

See Also:
addParam(String, String)

getType

java.lang.String getType()
Returns the name of the return type of this ActionScript method, or null if it is untyped.


setType

void setType(java.lang.String string)
Defines the name of the type of object returned by this ActionScript method. May be set to null, denoting that the return value is untyped.


addParam

ASArg addParam(java.lang.String name,
               java.lang.String type)
Adds a formal parameter to the list of parameters supported by this ActionScript method.

Parameters:
name - The name for the parameter
type - The type for the parameter, or null if the parameter is to be untyped
Returns:
the newly created parameter
See Also:
addRestParam(String)

addRestParam

ASArg addRestParam(java.lang.String name)
Adds a 'rest' parameter to the list of parameters supported by this ActionScript method.

e.g. The java code,

ASMethod meth = class.newMethod("test", Visibility.PUBLIC, "void");
meth.addRestParam("foo");

will result in ActionScript code like,

public function test(...foo):void {
}

To create an anonymous 'rest' parameter, pass the name "..." (this name can also be passed to removeParam() to remove an anonymous rest parameter).

Returns:
the newly created parameter
See Also:
addParam(String,String)

removeParam

ASArg removeParam(java.lang.String string)
Removes the named parameter from this ActionScript methods formal parameter list. In the case of a 'rest' parameter, give the name of the parameter without the ellipsis prefix (i.e. if the parameter is declared as "...foo", pass the name "foo" to this method). To remove an anonymous 'rest' parameter, pass the string "..." as the argument to this method.

Returns:
the removed parameter, if found, or null otherwise.


Copyright © 2006-2008 David Holroyd. All Rights Reserved.