|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
This interface specifies "environment" behavior, as some shared state that is scoped and made available to some parts of an application.
Implementations of this interface are expected to follow a delegation model where given instances can have other instances as ancesters, and where the ancestors are "consulted" after a given operation is performed at a child - and if that operation fails at the child.
| Method Summary | |
|---|---|
Object |
acquire(String name)
|
Object |
acquire(String name,
String scope)
|
void |
addScope(String name,
Scope scope)
This methods internally binds the given scope under the given name within this instance. |
Object |
get(String name)
This method attempts to retrieve the object bound under the given name. |
Object |
get(String name,
String scope)
This method looks for the object of the given name in the specified scope. |
Scope |
getScope(String name)
Returns the scope that corresponds to the given name. |
boolean |
hasScope(String name)
|
void |
put(String name,
Object obj,
String scope)
Puts the given object in the given scope, under the given name. |
void |
removeScope(String name)
Removes the scope with the given name from this instance. |
| Method Detail |
public Object get(String name)
This method looks for the object in all scopes, in the order in which the scopes where created.
name - the name of an object.
Object, or null if no
such object was found.addScope(String, Scope),
put(String, Object, String)
public Object get(String name,
String scope)
get(String)
public Object acquire(String name)
throws IllegalArgumentException
IllegalArgumentException - if the desired object could not be found.get(String)
public Object acquire(String name,
String scope)
throws IllegalArgumentException
IllegalArgumentException - if the desired object could not be found.get(String, String)
public void put(String name,
Object obj,
String scope)
name - the name under which to bind the object.obj - the Object to bind.scope - the name of the scope under which to bind the object.
public void addScope(String name,
Scope scope)
In addition, if a scope with the given name already exists within this instance, it is overwritten.
name - the name under which the given scope should be kept within this instance.scope - a Scope.public void removeScope(String name)
name - the name of a scope.public Scope getScope(String name)
name - the name of a scope.
Scope corresponding to the given name, or
null if no such scope exists.public boolean hasScope(String name)
name - the name of a scope.
true if this instance or one of its ancestors has such
a scope.
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||