Commit 61a4a71d authored by Lubomir Bulej's avatar Lubomir Bulej

Updated documentation related to argument processing.

parent f5e11e8e
......@@ -19,16 +19,16 @@ import ch.usi.dag.disl.staticcontext.StaticContext;
* <p>
* An argument processor <b>method</b> has the argument type as its first
* parameter. Only primitive, {@link String}, and {@link Object} types are
* allowed. In some cases, the type accepted by the argument processor method
* can be extended using the {@link ProcessAlso} annotation. At runtime, the
* second parameter of the argument processor will contain the value of the
* argument being processed.
* permitted. For some primitive integer types, the set of types accepted by an
* argument processor method can be extended using the {@link ProcessAlso}
* annotation.
* <p>
* Additional information (e.g. position) about the argument can be obtained
* using the {@link ArgumentContext} interface. To use it, an argument processor
* method must have a parameter of type {@link ArgumentContext}. Other allowed
* contexts are {@link StaticContext}, {@link DynamicContext}, and
* {@link ClassContext}.
* At runtime, the second parameter of an argument processor method will contain
* the value of the argument being processed. Additional information (e.g.
* position) about the argument being processed can be obtained using the
* {@link ArgumentContext} interface. To use it, an argument processor method
* must have a parameter of type {@link ArgumentContext}. Other allowed contexts
* are {@link StaticContext}, {@link DynamicContext}, and {@link ClassContext}.
* <p>
* All argument processor methods must be static, may not return any values, and
* may not throw any exceptions.
......
......@@ -30,7 +30,7 @@ public @interface ProcessAlso {
// Also note that the defaults are not retrieved from here, but
// are set in the DiSL class parser.
//
// TODO Consider support for {@code long} types.
// TODO Support for {@code integer} and {@code float} types with {@code long} and {@code double} parameters.
//
/**
......
package ch.usi.dag.disl.processorcontext;
import ch.usi.dag.disl.annotation.ArgumentProcessor;
/**
* Allows accessing information about particular argument.
* Provides information about a particular method argument from within an
* {@link ArgumentProcessor} snippet.
*/
public interface ArgumentContext {
/**
* Returns position of the processed argument.
* @return the position of the argument currently being processed.
*/
int getPosition ();
/**
* Returns type descriptor of the processed argument.
* @return the type descriptor of the processed argument.
*/
String getTypeDescriptor ();
/**
* Returns total number of processed arguments.
* @return the total number of arguments to be processed.
*/
int getTotalCount ();
}
package ch.usi.dag.disl.processorcontext;
/**
* Provides access to method arguments. This can be done either by querying the
* arguments directly using the {@link #getArgs(ArgumentProcessorMode) getArgs)
* method, which returns a newly allocated array containing the method
* arguments, or by applying an argument processor using the
* {@link #apply(Class, ArgumentProcessorMode) apply} method, which allows
* iterating over the arguments without having to allocate any memory.
* <p>
* Allows accessing method arguments and applying argument processors.
* <ul>
* <li>{@link #apply(Class, ArgumentProcessorMode)}</li>
* <li>{@link #getReceiver(ArgumentProcessorMode)}</li>
* <li>{@link #getArgs(ArgumentProcessorMode)}</li>
* </ul>
* Depending on the {@link ArgumentProcessorMode}, the methods of an
* {@link ArgumentProcessorContext} refer either to the currently executing
* method, or to the current call site.
*/
public interface ArgumentProcessorContext {
/**
* Applies given argument processor to method arguments, either at call-site
* Applies the given argument processor to method arguments, either at call-site
* or within an invoked method.
*
* @param argumentProcessorClass
......
package ch.usi.dag.disl.processorcontext;
/**
* Decides, what argument data should be made available.
* Determines the scope of {@link ArgumentProcessorContext} methods.
*/
public enum ArgumentProcessorMode {
......@@ -9,7 +9,7 @@ public enum ArgumentProcessorMode {
* Arguments of the current method.
*/
METHOD_ARGS,
/**
* Arguments of the method being invoked.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment