Package org.apache.tapestry5.internal.services

# Class EnvironmentImpl

java.lang.Object
org.apache.tapestry5.internal.services.EnvironmentImpl

All Implemented Interfaces:
  `Environment`

public class EnvironmentImpl extends Object implements Environment
A non-threadsafe implementation (expects to use the "perthread" service lifecyle).

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EnvironmentImpl()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `cloak()`
  Hides all current environment values, making the Environment object appear empty, until a call to `Environment.decloak()`} restores the original state.
  `void`
  `decloak()`
  Restores state previously hidden by `Environment.cloak()`}.
  `<T> T`
  `peek(Class<T> type)`
  Peeks at the current top of the indicated stack.
  `<T> T`
  `peekRequired(Class<T> type)`
  Peeks at the current top of the indicated stack (which must have a non-null value).
  `<T> T`
  `pop(Class<T> type)`
  Removes and returns the top environmental object of the selected type.
  `<T> T`
  `push(Class<T> type, T instance)`
  Pushes a new service onto the stack.
  `void`
  `threadDidCleanup()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### EnvironmentImpl

    public EnvironmentImpl()

- ## Method Details

  - ### peek

    public <T> T peek(Class<T> type)
    Description copied from interface: `Environment`
    Peeks at the current top of the indicated stack.
    Specified by:
      `peek` in interface `Environment`
    Type Parameters:
      `T` - the type of environmental object
    Parameters:
      `type` - class used to select the object
    Returns:
      the current object of that type, or null if no service of that type has been added

  - ### peekRequired

    public <T> T peekRequired(Class<T> type)
    Description copied from interface: `Environment`
    Peeks at the current top of the indicated stack (which must have a non-null value).
    Specified by:
      `peekRequired` in interface `Environment`
    Type Parameters:
      `T` - the type of environmental object
    Parameters:
      `type` - class used to select the object
    Returns:
      the current object of the specified type

  - ### pop

    public <T> T pop(Class<T> type)
    Description copied from interface: `Environment`
    Removes and returns the top environmental object of the selected type.
    Specified by:
      `pop` in interface `Environment`
    Type Parameters:
      `T` - the type of environmental object
    Parameters:
      `type` - class used to select the object
    Returns:
      the object just removed

  - ### push

    public <T> T push(Class<T> type, T instance)
    Description copied from interface: `Environment`
    Pushes a new service onto the stack. The old service at the top of the stack is returned (it may be null).
    Specified by:
      `push` in interface `Environment`
    Type Parameters:
      `T` - the type of environmental object
    Parameters:
      `type` - class used to select the object
      `instance` - the service object
    Returns:
      the previous top service

  - ### threadDidCleanup

    public void threadDidCleanup()

  - ### cloak

    public void cloak()
    Description copied from interface: `Environment`
    Hides all current environment values, making the Environment object appear empty, until a call to `Environment.decloak()`} restores the original state.
    Specified by:
      `cloak` in interface `Environment`
    See Also:
      - `TapestryConstants.RESPONSE_RENDERER`

  - ### decloak

    public void decloak()
    Description copied from interface: `Environment`
    Restores state previously hidden by `Environment.cloak()`}.
    Specified by:
      `decloak` in interface `Environment`
    See Also:
      - `TapestryConstants.RESPONSE_RENDERER`