org.nodal.util
Class BindingContexts

java.lang.Object
  extended byorg.nodal.util.BindingContexts
All Implemented Interfaces:
BindingContext

public class BindingContexts
extends java.lang.Object
implements BindingContext

The default implementation for BindingContext. Created on Jul 17, 2003

Author:
leei

Constructor Summary
protected BindingContexts(BindingContext parent, java.util.Map bindings)
          A private constructor to ensure that all creations pass through the static constructor create().
 
Method Summary
 java.lang.Object bind(Name nm, java.lang.Object val)
          Bind a value to the given Name.
 java.lang.Object bound(Name nm)
          Obtain the Object bound to a particular Name.
static BindingContext create()
          Create a new BindingContext with strong, synchronized binding.
static BindingContext createWeak()
          Create a new BindingContext with weak, synchronized binding.
static BindingContext embed(BindingContext parent)
          Create a strong BindingContext that is enclosed in a parent binding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindingContexts

protected BindingContexts(BindingContext parent,
                          java.util.Map bindings)
A private constructor to ensure that all creations pass through the static constructor create().

Method Detail

create

public static BindingContext create()
Create a new BindingContext with strong, synchronized binding.

Returns:
a new BindingContext

createWeak

public static BindingContext createWeak()
Create a new BindingContext with weak, synchronized binding.

Returns:
a new BindingContext

embed

public static BindingContext embed(BindingContext parent)
Create a strong BindingContext that is enclosed in a parent binding.

Parameters:
parent - the enclosing BindingContext
Returns:
a BindingContext that extends the enclosing context.

bound

public java.lang.Object bound(Name nm)
Description copied from interface: BindingContext
Obtain the Object bound to a particular Name.

Specified by:
bound in interface BindingContext
Parameters:
nm - the Name to use as a reference
Returns:
the Object bound if one exists, or null if not.

bind

public java.lang.Object bind(Name nm,
                             java.lang.Object val)
Description copied from interface: BindingContext
Bind a value to the given Name.

Specified by:
bind in interface BindingContext
Parameters:
nm - the Name to use for this binding
val - the Object to use as a value
Returns:
any previous binding for the Name nm