Package org.apache.sling.models.spi

# Interface Injector

@ConsumerType public interface Injector
Service interface for pluggable value injectors.

## Method Summary

Modifier and Type
Method
Description
`@NotNull String`
`getName()`
Return a logical name for the injector.
`@Nullable Object`
`getValue(@NotNull Object adaptable, String name, @NotNull Type declaredType, @NotNull AnnotatedElement element, @NotNull DisposalCallbackRegistry callbackRegistry)`
Produce a value for an injection point.

## Method Details

### getName

@NotNull @NotNull String getName()
Return a logical name for the injector. Used in resolving

    @Source

annotations.

Returns:
  the injector's name

### getValue

@Nullable @Nullable Object getValue(@NotNull @NotNull Object adaptable, String name, @NotNull @NotNull Type declaredType, @NotNull @NotNull AnnotatedElement element, @NotNull @NotNull DisposalCallbackRegistry callbackRegistry)
Produce a value for an injection point.

Parameters:
  `adaptable` - the object which should be used as the basis for value resolution.
  `name` - the injection point name (may be only `null` if injector implements the `AcceptsNullName` interface, otherwise never `null`)
  `declaredType` - the declared type of the injection point
  `element` - the injection point itself
  `callbackRegistry` - a registry object to register a callback object which will be invoked when the adapted object is disposed.
Returns:
  the value to be injected or null if no value could be resolved