org.mentawai.core
Interface Context

All Known Implementing Classes:
ApplicationContext, CookieContext, MapContext, SessionContext

public interface Context

Describes the behavior of a Mentawai context. A context has attributes that can be any java object. Each attribute is associated to the context by a name. A context can be invalidated.

Author:
Sergio Oliveira

Method Summary
 Object getAttribute(String name)
          Gets an attribute value associated with the given name.
 boolean hasAttribute(String name)
          Returns true is an attribute exists with this name.
 Iterator<String> keys()
          Return an iterator with all the attribute names in this context.
 void removeAttribute(String name)
          Removes an attribute associated with the given name.
 void reset()
          Resets this context.
 void setAttribute(String name, Object value)
          Sets an attribute value associated with the given name.
 

Method Detail

getAttribute

Object getAttribute(String name)
Gets an attribute value associated with the given name.

Parameters:
name - The name of the attribute.
Returns:
The value of the attribute or null if it doesn't exist.

setAttribute

void setAttribute(String name,
                  Object value)
Sets an attribute value associated with the given name. If the attribute already exists, overwrite it.

Parameters:
name - The name of the attribute.
value - The value of the attribute.

removeAttribute

void removeAttribute(String name)
Removes an attribute associated with the given name.

Parameters:
name - The name of the attribute.

reset

void reset()
Resets this context. All values are discarded and a new context is internally created.


hasAttribute

boolean hasAttribute(String name)
Returns true is an attribute exists with this name.

Parameters:
name - The name of the attribute.
Returns:
true if the attribute exists

keys

Iterator<String> keys()
Return an iterator with all the attribute names in this context.

Returns:
an iterator with the attribute names


Copyright © 2013. All Rights Reserved.