Class MultiValuesConverterFactory.MultiValuesToIterableConverter

java.lang.Object
io.micronaut.core.convert.converters.MultiValuesConverterFactory.MultiValuesToIterableConverter
All Implemented Interfaces:
FormattingTypeConverter<ConvertibleMultiValues,Iterable,Format>, TypeConverter<ConvertibleMultiValues,Iterable>
Enclosing class:
MultiValuesConverterFactory

public static class MultiValuesConverterFactory.MultiValuesToIterableConverter extends Object
A converter to convert from ConvertibleMultiValues to an Iterable.
  • Field Details

  • Constructor Details

    • MultiValuesToIterableConverter

      public MultiValuesToIterableConverter(ConversionService conversionService)
  • Method Details

    • retrieveSeparatedValue

      protected Optional<Iterable> retrieveSeparatedValue(ArgumentConversionContext<Iterable> conversionContext, String name, ConvertibleMultiValues<String> parameters, String defaultValue, Character delimiter)
      Method to retrieve the values from a separated parameter and return the parameter in desired type.
      Parameters:
      conversionContext - the conversion context of the value to which conversion is done (including type and annotations)
      name - the name of the parameter
      parameters - all the parameters from which the parameter of given name needs to be retrieved
      defaultValue - default value
      delimiter - the delimiter of the values in the parameter String
      Returns:
      the converted value if conversion was successful
    • retrieveMultiValue

      protected Optional<Iterable> retrieveMultiValue(ArgumentConversionContext<Iterable> conversionContext, String name, ConvertibleMultiValues<String> parameters)
      Method to retrieve the values from a parameter in MULTI format and return in desired type.
      Parameters:
      conversionContext - the conversion context of the value to which conversion is done (including type and annotations)
      name - the name of the parameter
      parameters - all the parameters from which the parameter of given name needs to be retrieved
      Returns:
      the converted value if conversion was successful
    • retrieveDeepObjectValue

      protected Optional<Iterable> retrieveDeepObjectValue(ArgumentConversionContext<Iterable> conversionContext, String name, ConvertibleMultiValues<String> parameters)
      Method to retrieve the values from a parameter in DEEP_OBJECT format and return in desired type.
      Parameters:
      conversionContext - the conversion context of the value to which conversion is done (including type and annotations)
      name - the name of the parameter
      parameters - all the parameters from which the parameter of given name needs to be retrieved
      Returns:
      the converted value if conversion was successful
    • convert

      public Optional<Iterable> convert(ConvertibleMultiValues object, Class<Iterable> targetType, ConversionContext conversionContext)
      Implemented convert function that checks which Format is specified inside the Format annotation If one is specified, it calls one of the corresponding abstract methods. Otherwise empty optional is returned
      Specified by:
      convert in interface TypeConverter<ConvertibleMultiValues,T>
      Parameters:
      object - The object type
      targetType - The target type being converted to
      conversionContext - The ConversionContext
      Returns:
      The converted type or empty if the conversion is not possible
    • annotationType

      public Class<Format> annotationType()
      Specified by:
      annotationType in interface FormattingTypeConverter<ConvertibleMultiValues,T,Format>
      Returns:
      The annotation type for this formatter