Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5.services » [javadoc | source]
org.apache.tapestry5.services
public interface: Environment [javadoc | source]

All Known Implementing Classes:
    EnvironmentImpl

Provides access to environment services, which are almost always provided to enclosed components by enclosing components. Environmental services are a form of very late binding.

The Environment acts like a collection of stacks. Each stack contains environmental service instances of a given type. Most often, a stack has zero or one elements, but on occasion, a particular component will push an override onto the stack for the benefit of the components it encloses.

Method from org.apache.tapestry5.services.Environment Summary:
clear,   getAccess,   peek,   peekRequired,   pop,   push
Method from org.apache.tapestry5.services.Environment Detail:
 public  void clear()
    Clears all stacks; used when initializing the Environment before a render.
 public EnvironmentalAccess<T> getAccess(Class<T> type)
    For some type, returns a temporary access object for the type. The access object is efficient because it ties directly to the thread's instance of the Environment service, it also caches the current value.

    The access object must be discarded at the end of the request (it will be unusable at that point anyway).

 public T peek(Class<T> type)
    Peeks at the current top of the indicated stack.
 public T peekRequired(Class<T> type)
    Peeks at the current top of the indicated stack (which must have a non-null value).
 public T pop(Class<T> type)
    Removes and returns the top environmental service of the selected type.
 public T push(Class<T> type,
    T instance)
    Pushes a new service onto the stack. The old service at the top of the stack is returned (it may be null).