Interface TransformerContext

  • All Known Subinterfaces:
    ApplicationContext
    All Known Implementing Classes:
    ApplicationContextImpl, TransformerContextPropertiesWrapper

    public interface TransformerContext

    Definition of an interface for accessing data needed by transformers.

    This interface defines a set of methods for accessing system information like the current Locale or the resource manager. A Transformer object is passed an implementation of this interface, so it can make use of the methods defined here to obtain the data it needs.

    Version:
    $Id: TransformerContext.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • getLocale

        Locale getLocale()
        Returns the current Locale.
        Returns:
        the Locale to use
      • getResourceManager

        ResourceManager getResourceManager()
        Returns the current ResourceManager. This object can be used to access resources.
        Returns:
        the ResourceManager
      • properties

        Map<String,​Object> properties()
        Returns a map with properties. Transformers or validators can use this method for obtaining specific properties that may influence their behavior.
        Returns:
        a map with properties assigned to this context
      • getTypedProperty

        <T> T getTypedProperty​(Class<T> propCls)
        Returns the value of the property with the given type. Objects that are passed a TransformerContext have access to a set of properties which can impact their behavior. Using this method properties can be queried in a type-safe way. This is in contrast to the properties available through the properties() method. While the standard transformer implementations shipped with this library typically use the plain properties, this method is intended to be used by high-level custom transformers that need access to certain application-global objects. For instance, an application may store information about the currently edited object in its context. A Validator implementation may then access this data to perform specific checks. The type-safe properties available through this method are typically disjunct to the the ones provided by properties().An implementation should check whether a property of the specified type is available and return it. Otherwise, the method should return null.
        Type Parameters:
        T - the type of the property
        Parameters:
        propCls - the property class
        Returns:
        the value of this property or null if it is not set
      • getValidationMessageHandler

        ValidationMessageHandler getValidationMessageHandler()
        Returns the ValidationMessageHandler associated with this context. This object can be used for obtaining validation messages. It is used for instance by concrete Validator implementations.
        Returns:
        the ValidationMessageHandler for this context