Package org.apache.sling.models.impl.injectors

# Class ValueMapInjector

java.lang.Object
org.apache.sling.models.impl.injectors.ValueMapInjector

All Implemented Interfaces:
  `org.apache.sling.models.spi.Injector`, `org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessorFactory`, `org.apache.sling.models.spi.ValuePreparer`

public class ValueMapInjector extends Object implements org.apache.sling.models.spi.Injector, org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessorFactory, org.apache.sling.models.spi.ValuePreparer

## Constructor Summary

Constructors
Constructor
Description
`ValueMapInjector()`

## Method Summary

Modifier and Type
Method
Description
`org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor`
`createAnnotationProcessor(Object adaptable, AnnotatedElement element)`
`@NotNull String`
`getName()`
`protected org.apache.sling.api.resource.ResourceResolver`
`getResourceResolver(Object adaptable)`
`Object`
`getValue(@NotNull Object adaptable, String name, @NotNull Type type, @NotNull AnnotatedElement element, @NotNull org.apache.sling.models.spi.DisposalCallbackRegistry callbackRegistry)`
`protected @Nullable org.apache.sling.api.resource.ValueMap`
`getValueMap(Object adaptable)`
Retrieve the ValueMap from the given adaptable.
`protected boolean`
`isDeclaredTypeCollection(Type declaredType)`
`@NotNull Object`
`prepareValue(@NotNull Object adaptable)`
`protected @Nullable org.apache.sling.api.resource.ValueMap`
`toValueMap(org.apache.sling.api.resource.Resource resource)`

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

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

## Constructor Details

### ValueMapInjector

public ValueMapInjector()

## Method Details

### getName

@NotNull public @NotNull String getName()

Specified by:
  `getName` in interface `org.apache.sling.models.spi.Injector`

### getValue

public Object getValue(@NotNull @NotNull Object adaptable, String name, @NotNull @NotNull Type type, @NotNull @NotNull AnnotatedElement element, @NotNull @NotNull org.apache.sling.models.spi.DisposalCallbackRegistry callbackRegistry)

Specified by:
  `getValue` in interface `org.apache.sling.models.spi.Injector`

### prepareValue

@NotNull public @NotNull Object prepareValue(@NotNull @NotNull Object adaptable)

Specified by:
  `prepareValue` in interface `org.apache.sling.models.spi.ValuePreparer`

### createAnnotationProcessor

public org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor createAnnotationProcessor(Object adaptable, AnnotatedElement element)

Specified by:
  `createAnnotationProcessor` in interface `org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessorFactory`

### getResourceResolver

protected org.apache.sling.api.resource.ResourceResolver getResourceResolver(Object adaptable)

### getValueMap

@Nullable protected @Nullable org.apache.sling.api.resource.ValueMap getValueMap(Object adaptable)
Retrieve the ValueMap from the given adaptable. This succeeds, if the adaptable is either

- a `ValueMap`,
- a `SlingJakartaHttpServletRequest` or `SlingHttpServletRequest`, in which case the returned `ValueMap` is the one derived from the request's resource or
- adaptable to a `ValueMap`.

Otherwise `null` is returned.

Parameters:
  `adaptable` - Adaptable
Returns:
  a ValueMap or `null`.

### toValueMap

@Nullable protected @Nullable org.apache.sling.api.resource.ValueMap toValueMap(org.apache.sling.api.resource.Resource resource)

### isDeclaredTypeCollection

protected boolean isDeclaredTypeCollection(Type declaredType)