Class ValueMapInjector
java.lang.Object
org.apache.sling.models.impl.injectors.ValueMapInjector
- All Implemented Interfaces:
 Injector,InjectAnnotationProcessorFactory,ValuePreparer
public class ValueMapInjector
extends Object
implements Injector, InjectAnnotationProcessorFactory, ValuePreparer
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptioncreateAnnotationProcessor(Object adaptable, AnnotatedElement element) @NotNull StringgetName()Return a logical name for the injector.protected ResourceResolvergetResourceResolver(Object adaptable) getValue(@NotNull Object adaptable, String name, @NotNull Type type, @NotNull AnnotatedElement element, @NotNull DisposalCallbackRegistry callbackRegistry) Produce a value for an injection point.protected @Nullable ValueMapgetValueMap(Object adaptable) Retrieve the ValueMap from the given adaptable.protected booleanisDeclaredTypeCollection(Type declaredType) @NotNull ObjectprepareValue(@NotNull Object adaptable) Prepare a value from the adaptable. 
- 
Constructor Details
- 
ValueMapInjector
public ValueMapInjector() 
 - 
 - 
Method Details
- 
getName
Description copied from interface:InjectorReturn a logical name for the injector. Used in resolving@Source
annotations. - 
getValue
public Object getValue(@NotNull @NotNull Object adaptable, String name, @NotNull @NotNull Type type, @NotNull @NotNull AnnotatedElement element, @NotNull @NotNull DisposalCallbackRegistry callbackRegistry) Description copied from interface:InjectorProduce a value for an injection point.- Specified by:
 getValuein interfaceInjector- Parameters:
 adaptable- the object which should be used as the basis for value resolution.name- the injection point name (may be onlynullif injector implements theAcceptsNullNameinterface, otherwise nevernull)type- the declared type of the injection pointelement- the injection point itselfcallbackRegistry- 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
 
 - 
prepareValue
Description copied from interface:ValuePreparerPrepare a value from the adaptable.- Specified by:
 prepareValuein interfaceValuePreparer- Parameters:
 adaptable- the adaptable- Returns:
 - a prepared value or ObjectUtils.NULL if a value is not preparable
 
 - 
createAnnotationProcessor
public InjectAnnotationProcessor createAnnotationProcessor(Object adaptable, AnnotatedElement element) - Specified by:
 createAnnotationProcessorin interfaceInjectAnnotationProcessorFactory- Parameters:
 adaptable- the object from which this model is adaptedelement- the field or method which is annotated- Returns:
 - a ModelAnnotationProcessor in case there is a known
         injector-specific annotation on the given element found otherwise
         null. This method should return a 
InjectAnnotationProcessor2preferably. 
 - 
getResourceResolver
 - 
getValueMap
Retrieve the ValueMap from the given adaptable. This succeeds, if the adaptable is either- a 
ValueMap, - a 
SlingHttpServletRequest, in which case the returnedValueMapis the one derived from the request's resource or - adaptable to a 
ValueMap. 
nullis returned.- Parameters:
 adaptable- Adaptable- Returns:
 - a ValueMap or 
null. 
 - a 
 - 
isDeclaredTypeCollection
 
 -