org.webmacro.directive
Class ArgsHolder

java.lang.Object
  extended byorg.webmacro.directive.ArgsHolder
All Implemented Interfaces:
DirectiveArgs

public final class ArgsHolder
extends java.lang.Object
implements DirectiveArgs

ArgsHolder is a container for directive arguments. The parser creates and populates the ArgsHolder based on the contents of the directive descriptor. The directive, in the build() method, will call the getArg() methods to retrieve the arguments and build the directive.

Author:
Brian Goetz

Constructor Summary
ArgsHolder(Directive.ArgDescriptor[] args)
           
 
Method Summary
 java.lang.Object getArg(int id)
          Retrieve the argument whose id is the specified id.
 java.lang.Object getArg(int id, BuildContext bc)
          Retrieve the argument whose id is the specified id, and if it is a Builder, build it with the specified build context.
 int getArgCount()
          How many arguments does this ArgsHolder have?
 java.lang.Object getExactArg(int idx)
          Get the argument at the specified index.
 void setArg(int id, java.lang.Object o)
          Set the argument whose id is the specified id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgsHolder

public ArgsHolder(Directive.ArgDescriptor[] args)
Method Detail

getExactArg

public java.lang.Object getExactArg(int idx)
                             throws BuildException
Get the argument at the specified index. This is different than getting an argument by it's id

Specified by:
getExactArg in interface DirectiveArgs
Throws:
BuildException

getArgCount

public final int getArgCount()
How many arguments does this ArgsHolder have?

Specified by:
getArgCount in interface DirectiveArgs

getArg

public final java.lang.Object getArg(int id)
                              throws BuildException
Retrieve the argument whose id is the specified id.

Specified by:
getArg in interface DirectiveArgs
Throws:
BuildException

getArg

public final java.lang.Object getArg(int id,
                                     BuildContext bc)
                              throws BuildException
Retrieve the argument whose id is the specified id, and if it is a Builder, build it with the specified build context.

Specified by:
getArg in interface DirectiveArgs
Throws:
BuildException

setArg

public final void setArg(int id,
                         java.lang.Object o)
                  throws BuildException
Set the argument whose id is the specified id. If the argument has already been set, it is overwritten. Generally not used by directives, only used by the parser.

Specified by:
setArg in interface DirectiveArgs
Throws:
BuildException