Class PropertyGroup<C,GC>

java.lang.Object
com.github.veithen.alta.template.PropertyGroup<C,GC>
Type Parameters:
C - the type of context in which the template is evaluated
GC - the group context type

public abstract class PropertyGroup<C,GC> extends Object
Defines a group of properties. Properties in a group are evaluated in a context that is specific to the group and that is derived from the context object (that defines the context in which the template is evaluated). This group context is created only once even if the group is used multiple times in the template (see prepare(Object)). It can therefore be used for costly computations the results of which are used by all properties in the group.
  • Constructor Details

    • PropertyGroup

      public PropertyGroup(Class<GC> groupContextClass)
  • Method Details

    • getGroupContextClass

      public final Class<GC> getGroupContextClass()
    • addProperty

      public final void addProperty(String name, Property<GC> property)
    • getProperty

      public final Property<GC> getProperty(String name)
    • prepare

      public abstract GC prepare(C object) throws EvaluationException
      Create the group context for this property group and the given context object. The group context is later passed to Property.evaluate(Object) when the property is evaluated. During the evaluation of a template, this method is called exactly once for every property group used in that template.
      Parameters:
      object - the context object
      Returns:
      the group context or null if the property group is not supported for the given artifact
      Throws:
      EvaluationException