Class ValueUtils


  • public class ValueUtils
    extends Object
    Utility methods for handling references and activation
    • Constructor Detail

      • ValueUtils

        public ValueUtils()
    • Method Detail

      • getValueType

        public static ValueUtils.ValueType getValueType​(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​(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 reference
        metadata - The reference metadata
        typeClass - The type of the field/parameter
        f - The optional field. If null this is a constructor reference
        logger - The logger
        Returns:
        The value type for the field. If invalid, ValueType#ignore
      • getValue

        public static Object getValue​(String componentType,
                                      ValueUtils.ValueType type,
                                      Class<?> targetType,
                                      ComponentContextImpl componentContext,
                                      RefPair<?,​?> refPair)
        Get the value for the value type
        Parameters:
        componentType - The class of the component
        type - The value type
        targetType - Optional target type, only required for type ValueType#config_annotation.
        componentContext - The component context
        refPair - The ref pair
        Returns:
        The value or null.