Class EnvironmentImpl
- java.lang.Object
-
- org.apache.tapestry5.internal.services.EnvironmentImpl
-
- All Implemented Interfaces:
Environment
public class EnvironmentImpl extends java.lang.Object implements Environment
A non-threadsafe implementation (expects to use the "perthread" service lifecyle).
-
-
Constructor Summary
Constructors Constructor Description EnvironmentImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloak()Hides all current environment values, making the Environment object appear empty, until a call toEnvironment.decloak()} restores the original state.voiddecloak()Restores state previously hidden byEnvironment.cloak()}.<T> Tpeek(java.lang.Class<T> type)Peeks at the current top of the indicated stack.<T> TpeekRequired(java.lang.Class<T> type)Peeks at the current top of the indicated stack (which must have a non-null value).<T> Tpop(java.lang.Class<T> type)Removes and returns the top environmental object of the selected type.<T> Tpush(java.lang.Class<T> type, T instance)Pushes a new service onto the stack.voidthreadDidCleanup()
-
-
-
Constructor Detail
-
EnvironmentImpl
public EnvironmentImpl()
-
-
Method Detail
-
peek
public <T> T peek(java.lang.Class<T> type)
Description copied from interface:EnvironmentPeeks at the current top of the indicated stack.- Specified by:
peekin interfaceEnvironment- 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(java.lang.Class<T> type)
Description copied from interface:EnvironmentPeeks at the current top of the indicated stack (which must have a non-null value).- Specified by:
peekRequiredin interfaceEnvironment- 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(java.lang.Class<T> type)
Description copied from interface:EnvironmentRemoves and returns the top environmental object of the selected type.- Specified by:
popin interfaceEnvironment- 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(java.lang.Class<T> type, T instance)
Description copied from interface:EnvironmentPushes a new service onto the stack. The old service at the top of the stack is returned (it may be null).- Specified by:
pushin interfaceEnvironment- Type Parameters:
T- the type of environmental object- Parameters:
type- class used to select the objectinstance- the service object- Returns:
- the previous top service
-
threadDidCleanup
public void threadDidCleanup()
-
cloak
public void cloak()
Description copied from interface:EnvironmentHides all current environment values, making the Environment object appear empty, until a call toEnvironment.decloak()} restores the original state.- Specified by:
cloakin interfaceEnvironment- See Also:
TapestryConstants.RESPONSE_RENDERER
-
decloak
public void decloak()
Description copied from interface:EnvironmentRestores state previously hidden byEnvironment.cloak()}.- Specified by:
decloakin interfaceEnvironment- See Also:
TapestryConstants.RESPONSE_RENDERER
-
-