terp - the Codemesh Modular
Template Interpreter v1.3.337

com.codemesh.terp.api
Interface Scalar

All Known Implementing Classes:
Scalar.AbstractScalarTransformer, Scalar.Concatenate

public interface Scalar

The interface that signals that a particular transformer creates a scalar value from a collection. For example, there might be a max transformer that returns the largest item in a collection when invoked in such a way:

     {1,2,3,4}[max]
 
which yields the result 4.


Nested Class Summary
static class Scalar.AbstractScalarTransformer<T>
           
static class Scalar.Concatenate
           
 
Method Summary
 java.lang.Object done(java.lang.Object current)
          The method that is invoked after the last scalar operation has been performed.
 java.lang.Object scalar(java.lang.Object current, java.lang.Object next, java.util.List<java.lang.Object> args, TerpContext ctx)
          The method that is invoked after every item transformation to calculate the updated scalar value of the transformation.
 

Method Detail

scalar

java.lang.Object scalar(java.lang.Object current,
                        java.lang.Object next,
                        java.util.List<java.lang.Object> args,
                        TerpContext ctx)
The method that is invoked after every item transformation to calculate the updated scalar value of the transformation.

Parameters:
current - the current scalar value.
next - the next item to be handled.
args - optional scalar transformation parameters.
ctx - the evaluation context. This can for example be a string when using a separator transformer that concatenates all elements in a collection using a configurable separator string as a parameter.
Returns:
the next scalar value.

done

java.lang.Object done(java.lang.Object current)
The method that is invoked after the last scalar operation has been performed. this method returns the ultimate result of the scalar transformation. It can be used to return the ultimate result from a scalar transformer that uses an intermediate datatype to keep track of incremental state or it can be used to perform cleanup operations at the end of the transformation.

Parameters:
current - the current scalar value.
Returns:
the ultimate transformation result.

terp - the Codemesh Modular
Template Interpreter v1.3.337

Copyright © 2008-2016 by Codemesh, Inc. All Rights Reserved.