public interface Macro
extends sirius.kernel.di.std.Named
Modifier and Type | Method and Description |
---|---|
default Expression |
dereference(Template template,
Function<String,Emitter> blocks,
Expression[] args)
Replaces the call to this macro by an alternative expression if blocks are to be inlined.
|
Object |
eval(LocalRenderContext ctx,
Expression[] args)
Evaluates the macro at runtime.
|
String |
getDescription()
Provides a short description of what the macro does for documentation purposes.
|
Class<?> |
getType()
Returns the type of objects returned by this macro.
|
boolean |
isConstant(Expression[] args)
Determines if the macro is "constant" for the given parameter expressions.
|
void |
verifyArguments(List<Expression> args)
Verifies the arguments.
|
Class<?> getType()
void verifyArguments(List<Expression> args)
This is used to verify the type and count of arguments at compile time. If one or more arguments are invalid an
IllegalArgumentException
can be thrown.
args
- the expressions which will be passed in at runtime.Object eval(LocalRenderContext ctx, Expression[] args)
Note that the arguments are still expressions and have to be evaluated on demand.
ctx
- the rendering contextargs
- the argumentsboolean isConstant(Expression[] args)
args
- the arguments of the macroString getDescription()
default Expression dereference(Template template, Function<String,Emitter> blocks, Expression[] args)
template
- the template for which the blocks are dereferencedblocks
- the translator which resolves a block name into an Emitter
args
- the macro argumentsCopyright © 2018. All rights reserved.