Class ConstructorParameter
- java.lang.Object
-
- org.apache.sling.models.impl.model.ConstructorParameter
-
- All Implemented Interfaces:
InjectableElement
public class ConstructorParameter extends Object
Constructor parameters aren't normally accessible using the AnnotatedElement. This class acts as a facade to ease compatibility with field and method injection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConstructorParameter.FakeAnnotatedElement
-
Constructor Summary
Constructors Constructor Description ConstructorParameter(Annotation[] annotations, Type parameterType, Type genericType, boolean isPrimitive, int parameterIndex, org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory[] processorFactories, org.apache.sling.models.annotations.DefaultInjectionStrategy defaultInjectionStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotatedElementgetAnnotatedElement()ObjectgetDefaultValue()TypegetGenericType()StringgetName()intgetParameterIndex()TypegetParameterType()StringgetSource()TypegetType()StringgetVia()Class<? extends org.apache.sling.models.annotations.ViaProviderType>getViaProviderType()booleanhasDefaultValue()booleanisOptional(org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor annotationProcessor)booleanisPrimitive()StringtoString()
-
-
-
Constructor Detail
-
ConstructorParameter
public ConstructorParameter(Annotation[] annotations, Type parameterType, Type genericType, boolean isPrimitive, int parameterIndex, org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory[] processorFactories, org.apache.sling.models.annotations.DefaultInjectionStrategy defaultInjectionStrategy)
-
-
Method Detail
-
getGenericType
public Type getGenericType()
-
getParameterType
public Type getParameterType()
-
isPrimitive
public boolean isPrimitive()
- Returns:
- true if original type of injectable is a primitive type
-
getParameterIndex
public int getParameterIndex()
-
getAnnotatedElement
public final AnnotatedElement getAnnotatedElement()
- Specified by:
getAnnotatedElementin interfaceInjectableElement- Returns:
- Underlying annotated element
-
getType
public final Type getType()
- Specified by:
getTypein interfaceInjectableElement- Returns:
- Type of injectable mapped to wrapper class
-
getName
public final String getName()
- Specified by:
getNamein interfaceInjectableElement- Returns:
- Name for injection
-
getSource
public String getSource()
- Specified by:
getSourcein interfaceInjectableElement- Returns:
- Via annotation or null
-
getVia
public String getVia()
- Specified by:
getViain interfaceInjectableElement- Returns:
- Via annotation or null
-
getViaProviderType
public Class<? extends org.apache.sling.models.annotations.ViaProviderType> getViaProviderType()
- Specified by:
getViaProviderTypein interfaceInjectableElement
-
hasDefaultValue
public boolean hasDefaultValue()
- Specified by:
hasDefaultValuein interfaceInjectableElement- Returns:
- true, if a default value is set
-
getDefaultValue
public Object getDefaultValue()
- Specified by:
getDefaultValuein interfaceInjectableElement- Returns:
- Default value or null
-
isOptional
public boolean isOptional(org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor annotationProcessor)
- Specified by:
isOptionalin interfaceInjectableElement- Parameters:
annotationProcessor- Annotation processor- Returns:
trueif the element is optional otherwisefalse
-
-