Package org.apache.sling.scripting.sightly.impl.engine.extension

# Class ExtensionUtils

java.lang.Object
org.apache.sling.scripting.sightly.impl.engine.extension.ExtensionUtils

public class ExtensionUtils extends Object
Helper class for `RuntimeExtension` implementations.

## Method Summary

Modifier and Type
Method
Description
`static void`
`checkArgumentCount(String extensionName, Object[] arguments, int count)`
Helper method for checking if the number of arguments passed to a `RuntimeExtension` are equal to what the extension requires.
`static Map<String,Object>`
`setRequestAttributes(org.apache.sling.api.SlingJakartaHttpServletRequest request, Map<String,Object> newRequestAttributes)`
Helper method for setting specific attributes in a `SlingJakartaHttpServletRequest` scope

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

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

## Method Details

### checkArgumentCount

public static void checkArgumentCount(String extensionName, Object[] arguments, int count)
Helper method for checking if the number of arguments passed to a `RuntimeExtension` are equal to what the extension requires.

Parameters:
  `extensionName` - the name of the extension
  `arguments` - the arguments array
  `count` - the expected number or arguments
Throws:
  `org.apache.sling.scripting.sightly.SightlyException` - if the number of supplied arguments differs from what's expected

### setRequestAttributes

public static Map<String,Object> setRequestAttributes(org.apache.sling.api.SlingJakartaHttpServletRequest request, Map<String,Object> newRequestAttributes)
Helper method for setting specific attributes in a `SlingJakartaHttpServletRequest` scope

Parameters:
  `request` - the `SlingJakartaHttpServletRequest`
  `newRequestAttributes` - the `Map` of attributes to set
Returns:
  A `Map` of original attributes values for substituted keys