Fork me on GitHub

Concepts

Therian

Central access point of the API; provides the TherianContext in which an Operation may be evaluated. A Therian instance can be created with entirely custom behavior; alternatively a standard or other pre-configured instance may be used.

TherianContext

Context for evaluation Operations supported by a given Therian instance. A TherianContext is a particular type of javax.el.ELContext and can be used in place of one. Therian can provide a standalone context or wrap an existing ELContext instance.

Operation

A function, e.g. Convert, Copy, etc., whose evaluation yields a single result of a predictable Type. The evaluation of operations is the primary purpose of therian. An Operation is defined in terms of one or more Positions (e.g. source/target). More

Position

Union of a java.lang.reflect.Type and a value; a Position may be readable, writable or both. therian is also aware of the notion of a relative Position which includes a “parent” Position. Object operands can be thought of as always being wrapped in a Position so that the system stays aware of the operand Type at all times.

Operator

An Operator implementation evaluates an Operation for some set of type parameters. A Therian instance can be configured with any number of Operators; when an Operation is evaluated in a TherianContext, Operators will be considered in order of type parameter assignability. An Operator implementation may be defined as explicitly depending on other Operator types by means of the @Operator.DependsOn(...) annotation.

Hint

Marker strategy interface, usually applied to an enum type. An Operator may recognize some Hint to guide its behavior, e.g. NOPConverter#NullBehavior, PropertyCopier#NullBehavior.

TherianModule

Unit of configuration; a Therian instance is created with one or more TherianModules so that a suite of custom behavior can be neatly reused. In addition to Operators a TherianModule may specifyjavax.el.ELResolvers and javax.el.ELContextListeners (bearing in mind that aTherianContext_is an_ ELContext). APIs are provided for specifying aTherianModuleinline; alternatively you may define aTherianModule` subclass.

Therian and Unified EL

  • Operator API designed for similarity with javax.el.ELResolver
  • defer simple Convert Operations to EL “type coercion” where possible
  • relative positions Property (of object), Element (of Iterable/array), Keyed.Value (of Map) use EL facilities wherever possible so custom types can be made accessible to therian using custom ELResolvers that you may already have implemented.
  • Operators have access to the TherianContext, which is to say an ELContext and anything it has; e.g. Locale information and context object storage.