Package org.apache.sling.scripting.sightly.impl.utils

# Class BindingsUtils

java.lang.Object
org.apache.sling.scripting.sightly.impl.utils.BindingsUtils

public class BindingsUtils extends Object
`BindingsUtils` provides helper methods for retrieving commonly used objects from a `Bindings` map.

## Method Summary

Modifier and Type
Method
Description
`static org.apache.sling.api.scripting.SlingScriptHelper`
`getHelper(Bindings bindings)`
Retrieves the `SlingScriptHelper` from a `Bindings` map.
`static org.apache.sling.api.SlingJakartaHttpServletRequest`
`getJakartaRequest(Bindings bindings)`
Retrieves the `SlingJakartaHttpServletRequest` from a `Bindings` map.
`static org.apache.sling.api.SlingJakartaHttpServletResponse`
`getJakartaResponse(Bindings bindings)`
Retrieves the `SlingJakartaHttpServletResponse` from a `Bindings` map.
`static org.apache.sling.api.SlingHttpServletRequest`
`getRequest(Bindings bindings)`
Deprecated.
use `getJakartaRequest(Bindings)` instead
`static org.apache.sling.api.resource.Resource`
`getResource(Bindings bindings)`
Retrieves the `Resource` from a `Bindings` map.
`static org.apache.sling.api.SlingHttpServletResponse`
`getResponse(Bindings bindings)`
Deprecated.
use `getJakartaResponse(Bindings)` instead
`static Bindings`
`merge(Bindings former, Bindings latter)`
Combine two bindings objects.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getResource

public static org.apache.sling.api.resource.Resource getResource(Bindings bindings)
Retrieves the `Resource` from a `Bindings` map.

Parameters:
  `bindings` - the bindings map
Returns:
  the `Resource` if found, `null` otherwise

### getRequest

@Deprecated(since="2.0.0-1.4.0") public static org.apache.sling.api.SlingHttpServletRequest getRequest(Bindings bindings)
Deprecated.
use `getJakartaRequest(Bindings)` instead
Retrieves the `SlingHttpServletRequest` from a `Bindings` map.

Parameters:
  `bindings` - the bindings maps
Returns:
  the `SlingHttpServletRequest` if found, `null` otherwise

### getResponse

@Deprecated(since="2.0.0-1.4.0") public static org.apache.sling.api.SlingHttpServletResponse getResponse(Bindings bindings)
Deprecated.
use `getJakartaResponse(Bindings)` instead
Retrieves the `SlingHttpServletResponse` from a `Bindings` map.

Parameters:
  `bindings` - the bindings maps
Returns:
  the `SlingHttpServletResponse` if found, `null` otherwise

### getJakartaRequest

public static org.apache.sling.api.SlingJakartaHttpServletRequest getJakartaRequest(Bindings bindings)
Retrieves the `SlingJakartaHttpServletRequest` from a `Bindings` map.

Parameters:
  `bindings` - the bindings maps
Returns:
  the `SlingJakartaHttpServletRequest` if found, `null` otherwise

### getJakartaResponse

public static org.apache.sling.api.SlingJakartaHttpServletResponse getJakartaResponse(Bindings bindings)
Retrieves the `SlingJakartaHttpServletResponse` from a `Bindings` map.

Parameters:
  `bindings` - the bindings maps
Returns:
  the `SlingJakartaHttpServletResponse` if found, `null` otherwise

### getHelper

public static org.apache.sling.api.scripting.SlingScriptHelper getHelper(Bindings bindings)
Retrieves the `SlingScriptHelper` from a `Bindings` map.

Parameters:
  `bindings` - the bindings map
Returns:
  the `SlingScriptHelper` if found, `null` otherwise

### merge

public static Bindings merge(Bindings former, Bindings latter)
Combine two bindings objects. Priority goes to latter bindings.

Parameters:
  `former` - first map of bindings
  `latter` - second map of bindings, which can override the fist one
Returns:
  the merging of the two maps