Class Bindings
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasMap()
Returns an unmodifiableMap
view of thisBindings
instance.Binds a newvalue
to the givenname
.Binds all the bindings already bound fromsource
.static Bindings
bindings()
Returns an emptyBindings
instance (mutable).static Bindings
static Bindings
Returns aBindings
initialized with the givencontext
andrequest
.static Bindings
Returns aBindings
initialized with the givencontext
andrequest
.static Bindings
Returns aBindings
initialized with the givencontext
,request
andresponse
.Flatten the currentleaf
Context
into a Map keyed by context name.toString()
-
Constructor Details
-
Bindings
public Bindings()
-
-
Method Details
-
bindings
Returns an emptyBindings
instance (mutable).- Returns:
- an empty
Bindings
instance.
-
bindings
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
Returns aBindings
initialized with the givencontext
andrequest
.- Parameters:
context
- The context to exposerequest
- The request to expose- Returns:
- an initialized
Bindings
instance.
-
bindings
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
- Parameters:
name
- binding namevalue
- binding value- Returns:
- an initialized
Bindings
instance.
-
bind
Binds a newvalue
to the givenname
.- Parameters:
name
- binding name (must not benull
)value
- binding value- Returns:
- this
Bindings
-
bind
Binds all the bindings already bound fromsource
.- Parameters:
source
- current bindings to copy (must not benull
)- Returns:
- this
Bindings
-
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
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:
-
toString
-