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 class
ConstructorParameter.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 AnnotatedElement
getAnnotatedElement()
Object
getDefaultValue()
Type
getGenericType()
String
getName()
int
getParameterIndex()
Type
getParameterType()
String
getSource()
Type
getType()
String
getVia()
Class<? extends org.apache.sling.models.annotations.ViaProviderType>
getViaProviderType()
boolean
hasDefaultValue()
boolean
isOptional(org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor annotationProcessor)
boolean
isPrimitive()
String
toString()
-
-
-
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:
getAnnotatedElement
in interfaceInjectableElement
- Returns:
- Underlying annotated element
-
getType
public final Type getType()
- Specified by:
getType
in interfaceInjectableElement
- Returns:
- Type of injectable mapped to wrapper class
-
getName
public final String getName()
- Specified by:
getName
in interfaceInjectableElement
- Returns:
- Name for injection
-
getSource
public String getSource()
- Specified by:
getSource
in interfaceInjectableElement
- Returns:
- Via annotation or null
-
getVia
public String getVia()
- Specified by:
getVia
in interfaceInjectableElement
- Returns:
- Via annotation or null
-
getViaProviderType
public Class<? extends org.apache.sling.models.annotations.ViaProviderType> getViaProviderType()
- Specified by:
getViaProviderType
in interfaceInjectableElement
-
hasDefaultValue
public boolean hasDefaultValue()
- Specified by:
hasDefaultValue
in interfaceInjectableElement
- Returns:
- true, if a default value is set
-
getDefaultValue
public Object getDefaultValue()
- Specified by:
getDefaultValue
in interfaceInjectableElement
- Returns:
- Default value or null
-
isOptional
public boolean isOptional(org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor annotationProcessor)
- Specified by:
isOptional
in interfaceInjectableElement
- Parameters:
annotationProcessor
- Annotation processor- Returns:
true
if the element is optional otherwisefalse
-
-