Package org.apache.felix.scr.impl.inject
Class ValueUtils
- java.lang.Object
-
- org.apache.felix.scr.impl.inject.ValueUtils
-
public class ValueUtils extends java.lang.Object
Utility methods for handling references and activation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ValueUtils.MapEntryImpl
Comparable map entry using the service reference to compare.static class
ValueUtils.ValueType
The value type of the field, activation field or constructor parameter
-
Field Summary
Fields Modifier and Type Field Description static ValueUtils.ValueType[]
EMPTY_VALUE_TYPES
Empty array.
-
Constructor Summary
Constructors Constructor Description ValueUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.Object
getLogger(java.lang.String componentType, java.lang.Class<?> targetType, ComponentContextImpl componentContext, RefPair<?,?> refPair)
static ValueUtils.ValueType
getReferenceValueType(java.lang.Class<?> componentClass, ReferenceMetadata metadata, java.lang.Class<?> typeClass, java.lang.reflect.Field field, ComponentLogger logger)
Get the value type of the reference for a field/constructor argumentstatic java.lang.Object
getValue(java.lang.String componentType, ValueUtils.ValueType type, java.lang.Class<?> targetType, ComponentContextImpl componentContext, RefPair<?,?> refPair)
Get the value for the value typestatic ValueUtils.ValueType
getValueType(java.lang.Class<?> typeClass)
Get the value type for the parameter class.
-
-
-
Field Detail
-
EMPTY_VALUE_TYPES
public static final ValueUtils.ValueType[] EMPTY_VALUE_TYPES
Empty array.
-
-
Method Detail
-
getValueType
public static ValueUtils.ValueType getValueType(java.lang.Class<?> typeClass)
Get the value type for the parameter class. This method is used for field activation and constructor injection.- Parameters:
typeClass
- The class of the parameter- Returns:
- The value type
-
getReferenceValueType
public static ValueUtils.ValueType getReferenceValueType(java.lang.Class<?> componentClass, ReferenceMetadata metadata, java.lang.Class<?> typeClass, java.lang.reflect.Field field, ComponentLogger logger)
Get the value type of the reference for a field/constructor argument- Parameters:
componentClass
- The component class declaring the referencemetadata
- The reference metadatatypeClass
- The type of the field/parameterf
- The optional field. Ifnull
this is a constructor referencelogger
- The logger- Returns:
- The value type for the field. If invalid,
ValueType#ignore
-
getValue
public static java.lang.Object getValue(java.lang.String componentType, ValueUtils.ValueType type, java.lang.Class<?> targetType, ComponentContextImpl componentContext, RefPair<?,?> refPair)
Get the value for the value type- Parameters:
componentType
- The class of the componenttype
- The value typetargetType
- Optional target type, only required for typeValueType#config_annotation
.componentContext
- The component contextrefPair
- The ref pair- Returns:
- The value or
null
.
-
getLogger
private static java.lang.Object getLogger(java.lang.String componentType, java.lang.Class<?> targetType, ComponentContextImpl componentContext, RefPair<?,?> refPair)
-
-