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 Details

    • Bindings

      public Bindings()
  • Method Details

    • bindings

      public static Bindings bindings()
      Returns an empty Bindings instance (mutable).
      Returns:
      an empty Bindings instance.
    • bindings

      public static Bindings bindings(Context context)
      Returns a Bindings initialized with the given context and request.

      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 the AttributesContext and to the session from the SessionContext.

      Parameters:
      context - The context to expose
      Returns:
      an initialized Bindings instance.
    • bindings

      public static Bindings bindings(Context context, Request request)
      Returns a Bindings initialized with the given context and request.
      Parameters:
      context - The context to expose
      request - The request to expose
      Returns:
      an initialized Bindings instance.
    • bindings

      public static Bindings bindings(Context context, Request request, Response response)
      Returns a Bindings initialized with the given context, request and response.
      Parameters:
      context - The context to expose
      request - The request to expose
      response - The response to expose
      Returns:
      an initialized Bindings instance.
    • bindings

      public static Bindings bindings(String name, Object value)
      Returns a singleton Bindings initialized with the given name and value.
      Parameters:
      name - binding name
      value - binding value
      Returns:
      an initialized Bindings instance.
    • bind

      public Bindings bind(String name, Object value)
      Binds a new value to the given name.
      Parameters:
      name - binding name (must not be null)
      value - binding value
      Returns:
      this Bindings
    • bind

      public Bindings bind(Bindings source)
      Binds all the bindings already bound from source.
      Parameters:
      source - current bindings to copy (must not be null)
      Returns:
      this Bindings
    • asMap

      public Map<String,Object> asMap()
      Returns an unmodifiable Map view of this Bindings 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 (never null).
    • flatten

      public static Map<String,Context> flatten(Context leaf)
      Flatten the current leaf 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

      public String toString()
      Overrides:
      toString in class Object