org.xwiki.context
Class ExecutionContext

java.lang.Object
  extended by org.xwiki.context.ExecutionContext

public class ExecutionContext
extends Object

Contains all state data related to the current user action. Note that the execution context is independent of the environment and all environment-dependent data are stored in the Container component instead.

Since:
1.5M2
Version:
$Id: 0e5cfe04fb48a3221e58c38fc3784bc44684cd15 $

Nested Class Summary
 class ExecutionContext.DeclarationBuilder
          Builder class for declaring a new proprety.
 
Constructor Summary
ExecutionContext()
           
 
Method Summary
 Map<String,Object> getProperties()
           
 Object getProperty(String key)
           
 boolean hasProperty(String key)
           
 void inheritFrom(ExecutionContext executionContext)
          Inherit properties marked for inheritance from the given execution context.
 ExecutionContext.DeclarationBuilder newProperty(String key)
           
 void removeProperty(String key)
           
 void setProperties(Map<String,Object> properties)
           
 void setProperty(String key, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionContext

public ExecutionContext()
Method Detail

getProperty

public Object getProperty(String key)
Parameters:
key - the key under which is stored the property to retrieve
Returns:
the property matching the passed key

newProperty

public ExecutionContext.DeclarationBuilder newProperty(String key)
Parameters:
key - the key of the property.
Returns:
a builder object for performing the declaration. The property will not be declared until the declare method is called on the builder object.

hasProperty

public boolean hasProperty(String key)
Parameters:
key - the key under which is stored the property to retrieve
Returns:
true if there is a property declared for the given key.

getProperties

public Map<String,Object> getProperties()
Returns:
all the context properties

removeProperty

public void removeProperty(String key)
Parameters:
key - remove the property whose key matches the passed key

setProperty

public void setProperty(String key,
                        Object value)
Parameters:
key - the key under which to save the passed property value
value - the value to set

setProperties

public void setProperties(Map<String,Object> properties)
Parameters:
properties - the properties to add to the context

inheritFrom

public void inheritFrom(ExecutionContext executionContext)
Inherit properties marked for inheritance from the given execution context. Inheritance is performed both in Execution#setContext() and in Execution.pushContext(), if there is a current execution context. All properties marked as 'inherited' will be copied into this context, unless the property already is declared in this context. It is an error if this context contain a value that was declared as 'inherited' and 'final' in the inherited execution context and an exception will be thrown.

Parameters:
executionContext - The execution to inherit.
Throws:
IllegalStateException - if the execution context cannot be inherited.
Since:
4.3M1


Copyright © 2004-2012 XWiki. All Rights Reserved.