Class Bindings
- java.lang.Object
-
- org.forgerock.openig.el.Bindings
-
public class Bindings extends Object
Bindings represents the Expression bindings used during evaluation and assignation.
-
-
Constructor Summary
Constructors Constructor Description Bindings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
asMap()
Returns an unmodifiableMap
view of thisBindings
instance.Bindings
bind(String name, Object value)
Binds a newvalue
to the givenname
.Bindings
bind(Bindings source)
Binds all the bindings already bound fromsource
.static Bindings
bindings()
Returns an emptyBindings
instance (mutable).static Bindings
bindings(String name, Object value)
static Bindings
bindings(Context context)
Returns aBindings
initialized with the givencontext
andrequest
.static Bindings
bindings(Context context, Request request)
Returns aBindings
initialized with the givencontext
andrequest
.static Bindings
bindings(Context context, Request request, Response response)
Returns aBindings
initialized with the givencontext
,request
andresponse
.static Map<String,Context>
flatten(Context leaf)
Flatten the currentleaf
Context
into a Map keyed by context name.String
toString()
-
-
-
Method Detail
-
bindings
public static Bindings bindings()
Returns an emptyBindings
instance (mutable).- Returns:
- an empty
Bindings
instance.
-
bindings
public static Bindings bindings(Context context)
Returns aBindings
initialized with the givencontext
andrequest
.The returned bindings contain a
contexts
entry that provides easy access to visible parent Contexts (contexts.http, contexts.client, ...
).They also give access to the context's
attributes
from theAttributesContext
and to thesession
from theSessionContext
.- Parameters:
context
- The context to expose- Returns:
- an initialized
Bindings
instance.
-
bindings
public static Bindings bindings(Context context, Request request)
Returns aBindings
initialized with the givencontext
andrequest
.- Parameters:
context
- The context to exposerequest
- The request to expose- Returns:
- an initialized
Bindings
instance.
-
bindings
public static Bindings bindings(Context context, Request request, Response response)
Returns aBindings
initialized with the givencontext
,request
andresponse
.- Parameters:
context
- The context to exposerequest
- The request to exposeresponse
- The response to expose- Returns:
- an initialized
Bindings
instance.
-
bindings
public static Bindings bindings(String name, Object value)
- Parameters:
name
- binding namevalue
- binding value- Returns:
- an initialized
Bindings
instance.
-
bind
public Bindings bind(String name, Object value)
Binds a newvalue
to the givenname
.- Parameters:
name
- binding name (must not benull
)value
- binding value- Returns:
- this
Bindings
-
bind
public Bindings bind(Bindings source)
Binds all the bindings already bound fromsource
.- Parameters:
source
- current bindings to copy (must not benull
)- Returns:
- this
Bindings
-
asMap
public Map<String,Object> asMap()
Returns an unmodifiableMap
view of thisBindings
instance.Note that while the consumer of the Map cannot modify it, any changes done through the Bindings methods will be reflected in the returned Map.
- Returns:
- an unmodifiable
Map
view of this instance (nevernull
).
-
flatten
public static Map<String,Context> flatten(Context leaf)
Flatten the currentleaf
Context
into a Map keyed by context name.The Context hierarchy is walked from the given
leaf
to the root context, parent after parent.If a context's name has already been added into the Map while walking up the chain, the context will be ignored (shadowed by the previously registered context). That behaviour ensure that we'll return only the contexts that are close to the leaf.
- Parameters:
leaf
- Context used to start the walk-through- Returns:
- a Map of context
- See Also:
Context.getContextName()
-
-