uk.co.badgersinfoil.metaas.dom
Interface ASMethod

All Superinterfaces:
ASMember, Documentable, MetaTagable, StatementContainer

public interface ASMethod
extends StatementContainer, ASMember

Represents an ActionScript method definition within an ActionScript class or interface.

See Also:
ASType.newMethod(String, Visibility, String)

Nested Class Summary
static class ASMethod.AccessorRole
          Constants defined by this class denote whether a method is actually an acessor 'get' or 'set' function.
 
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.
 ASMethod.AccessorRole getAccessorRole()
          Returns on of ASMethod.AccessorRole.NORMAL_METHOD, ASMethod.AccessorRole.GETTER or ASMethod.AccessorRole.SETTER, with NORMAL_METHOD being the default for newly synthesized methods.
 java.util.List getArgs()
          Returns a list of the formal arguments accepted by this ActionScript method.
 java.lang.String getName()
          Returns the name of this method.
 java.lang.String getReturnDescriptionString()
          Returns any description of the return value from this methods documentation comment.
 java.lang.String getType()
          Returns the name of the return type of this ActionScript method, or null if it is untyped.
 Visibility getVisibility()
          Returns a value representing any protection-against-access defined for this ActionScript method.
 boolean isStatic()
          Returns true if this ActionScript method is static (i.e.
 ASArg removeParam(java.lang.String string)
          Removes the named parameter from this ActionScript methods formal parameter list.
 void setAccessorRole(ASMethod.AccessorRole getter)
          Allows the role of a method to be changed.
 void setReturnDescription(java.lang.String description)
          Shortcut method to update the @return tagged paragraph in this method's documentation comment, or create one if it doesn't exist.
 void setStatic(boolean s)
          Defines whether this ActionScript method is static or not.
 void setType(java.lang.String string)
          Defines the name of the type of object returned by this ActionScript method.
 void setVisibility(Visibility visibility)
          Defines the level of protection-against-external-access for this ActionScript method.
 
Methods inherited from interface uk.co.badgersinfoil.metaas.dom.StatementContainer
addComment, addStmt, containsCode, getStatementList, newDeclaration, newDoWhile, newExprStmt, newFor, newForEachIn, newForIn, newIf, newReturn, newSwitch, newWhile, newWith
 
Methods inherited from interface uk.co.badgersinfoil.metaas.dom.ASMember
setName
 
Methods inherited from interface uk.co.badgersinfoil.metaas.dom.MetaTagable
getAllMetaTags, getFirstMetatag, getMetaTagsWithName, newMetaTag
 
Methods inherited from interface uk.co.badgersinfoil.metaas.dom.Documentable
getDescriptionString, getDocComment, getDocumentation, setDescription, setDocComment
 

Method Detail

getName

java.lang.String getName()
Returns the name of this method.

Specified by:
getName in interface ASMember

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.

Specified by:
getType in interface ASMember

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.

Specified by:
setType in interface ASMember

getVisibility

Visibility getVisibility()
Returns a value representing any protection-against-access defined for this ActionScript method.

Specified by:
getVisibility in interface ASMember

setVisibility

void setVisibility(Visibility visibility)
Defines the level of protection-against-external-access for this ActionScript method.

Specified by:
setVisibility in interface ASMember

isStatic

boolean isStatic()
Returns true if this ActionScript method is static (i.e. the method definition uses the static keyword).

Specified by:
isStatic in interface ASMember

setStatic

void setStatic(boolean s)
Defines whether this ActionScript method is static or not.

Specified by:
setStatic in interface ASMember

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 paremeter
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 paremeter
See Also:
#addParam(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 elipsis 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.

getAccessorRole

ASMethod.AccessorRole getAccessorRole()
Returns on of ASMethod.AccessorRole.NORMAL_METHOD, ASMethod.AccessorRole.GETTER or ASMethod.AccessorRole.SETTER, with NORMAL_METHOD being the default for newly synthesized methods.


setAccessorRole

void setAccessorRole(ASMethod.AccessorRole getter)
Allows the role of a method to be changed.


setReturnDescription

void setReturnDescription(java.lang.String description)
Shortcut method to update the @return tagged paragraph in this method's documentation comment, or create one if it doesn't exist.


getReturnDescriptionString

java.lang.String getReturnDescriptionString()
Returns any description of the return value from this methods documentation comment. If there is no doc-comment, or if the documentation does not contain a @return tagged paragraph, this method will return null.

See Also:
DocComment


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