org.xlattice
Interface Template

All Known Implementing Classes:
BinaryTemplate, SeqTemplate, StringTemplate, TemplateImpl, VarTemplate

public interface Template

XXX THIS DOES NOT CONFORM TO THE IMPLEMENTATION IN PROGRESS.

Author:
Jim Dixon

Field Summary
static int TPL_APPLY
          A Template application, a data structure consisting of (1) a reference to the Template being applied and (2) a list of name-value pairs.
static int TPL_ATTR
          The Template consists of two Strings, the first of which should resolve in the Context to an object and the second of which is the name of a field in the class of which the object is an instance.
static int TPL_BINARY
          The Template is an irreducible byte array.
static int TPL_BY_NAME
          The Template is a String which should resolve to a Template in the Context.
static int TPL_IF
          A conditional Template consisting of a String value test and a reference to a Template.
static int TPL_IF_ELSE
          A conditional Template consisting of a String value test and references to two Templates.
static int TPL_MAP
          A Template mapping consisting of (1) a name referring to one or more values and (2) a reference to a Template.
static int TPL_REF
          The Template contains a reference to a Template.
static int TPL_SEQ
          A Template consisting of a number of Templates.
static int TPL_STRING
          The Template is an irreducible String.
static int TPL_VAR
          The Template is a String which should be looked up in the Context but is otherwise irreducible.
 
Method Summary
 byte[] getBytes(Context ctx)
          Recursively reduce all constituent Templates in the Context to byte arrays, concatenate them, and return the result.
 int getType()
           
 java.lang.String toString(Context ctx)
          Recursively reduce all constituent Templates in the Context to Strings, concatenate them, and return the result.
 

Field Detail

TPL_BINARY

static final int TPL_BINARY
The Template is an irreducible byte array.

See Also:
Constant Field Values

TPL_STRING

static final int TPL_STRING
The Template is an irreducible String.

See Also:
Constant Field Values

TPL_VAR

static final int TPL_VAR
The Template is a String which should be looked up in the Context but is otherwise irreducible. That is, any ${..} constructs within the String will not be translated, they will be left unchanged.

See Also:
Constant Field Values

TPL_ATTR

static final int TPL_ATTR
The Template consists of two Strings, the first of which should resolve in the Context to an object and the second of which is the name of a field in the class of which the object is an instance.

See Also:
Constant Field Values

TPL_REF

static final int TPL_REF
The Template contains a reference to a Template.

See Also:
Constant Field Values

TPL_BY_NAME

static final int TPL_BY_NAME
The Template is a String which should resolve to a Template in the Context. That is, this Template is a runtime reference to a Template by name.

See Also:
Constant Field Values

TPL_MAP

static final int TPL_MAP
A Template mapping consisting of (1) a name referring to one or more values and (2) a reference to a Template. XXX The Template should have a single unbound variable.

See Also:
Constant Field Values

TPL_APPLY

static final int TPL_APPLY
A Template application, a data structure consisting of (1) a reference to the Template being applied and (2) a list of name-value pairs. XXX The number of NV pairs in the list should be equal to XXX the number of Template parameters, and the names should XXX match.

See Also:
Constant Field Values

TPL_IF

static final int TPL_IF
A conditional Template consisting of a String value test and a reference to a Template. If test resolves to true in the Context, the Template is resolved in the Context. If test is undefined or is defined but does not resolve to true the Template is ignored.

See Also:
Constant Field Values

TPL_IF_ELSE

static final int TPL_IF_ELSE
A conditional Template consisting of a String value test and references to two Templates. If test resolves to true in the Context, the first Template is resolved in the Context. Otherwise the second Template is resolved.

See Also:
Constant Field Values

TPL_SEQ

static final int TPL_SEQ
A Template consisting of a number of Templates. An ordered set, a sequence.

See Also:
Constant Field Values
Method Detail

getType

int getType()
Returns:
one of the values specified above.

toString

java.lang.String toString(Context ctx)
Recursively reduce all constituent Templates in the Context to Strings, concatenate them, and return the result.


getBytes

byte[] getBytes(Context ctx)
Recursively reduce all constituent Templates in the Context to byte arrays, concatenate them, and return the result.