Class ValueUtils
java.lang.Object
org.apache.felix.scr.impl.inject.ValueUtils
Utility methods for handling references and activation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classComparable map entry using the service reference to compare.static enumThe value type of the field, activation field or constructor parameter -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ObjectgetLogger(String componentType, Class<?> targetType, ScrComponentContext componentContext, RefPair<?, ?> refPair) static ValueUtils.ValueTypegetReferenceValueType(Class<?> componentClass, ReferenceMetadata metadata, Class<?> typeClass, Field field, ComponentLogger logger) Get the value type of the reference for a field/constructor argumentstatic ObjectgetValue(String componentType, ValueUtils.ValueType type, Class<?> targetType, ScrComponentContext componentContext, RefPair<?, ?> refPair) Get the value for the value typestatic ValueUtils.ValueTypegetValueType(Class<?> typeClass) Get the value type for the parameter class.
-
Field Details
-
EMPTY_VALUE_TYPES
Empty array.
-
-
Constructor Details
-
ValueUtils
public ValueUtils()
-
-
Method Details
-
getValueType
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(Class<?> componentClass, ReferenceMetadata metadata, Class<?> typeClass, 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/parameterlogger- The loggerf- The optional field. Ifnullthis is a constructor reference- Returns:
- The value type for the field. If invalid,
ValueType#ignore
-
getValue
public static Object getValue(String componentType, ValueUtils.ValueType type, Class<?> targetType, ScrComponentContext 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 Object getLogger(String componentType, Class<?> targetType, ScrComponentContext componentContext, RefPair<?, ?> refPair)
-