Class AnnotationBasedArgumentConverter<A extends java.lang.annotation.Annotation>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private A annotation  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(A annotation)  
      protected abstract java.lang.Object convert​(java.lang.Object source, java.lang.Class<?> targetType, A annotation)
      Convert the supplied source object into the supplied targetType, based on metadata in the provided annotation.
      java.lang.Object convert​(java.lang.Object source, ParameterContext context)
      Convert the supplied source object according to the supplied context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Field Detail

      • annotation

        private A extends java.lang.annotation.Annotation annotation
    • Constructor Detail

      • AnnotationBasedArgumentConverter

        public AnnotationBasedArgumentConverter()
    • Method Detail

      • accept

        public final void accept​(A annotation)
        Specified by:
        accept in interface java.util.function.Consumer<A extends java.lang.annotation.Annotation>
      • convert

        public final java.lang.Object convert​(java.lang.Object source,
                                              ParameterContext context)
                                       throws ArgumentConversionException
        Description copied from interface: ArgumentConverter
        Convert the supplied source object according to the supplied context.
        Specified by:
        convert in interface ArgumentConverter
        Parameters:
        source - the source object to convert; may be null
        context - the parameter context where the converted object will be used; never null
        Returns:
        the converted object; may be null but only if the target type is a reference type
        Throws:
        ArgumentConversionException - if an error occurs during the conversion
      • convert

        protected abstract java.lang.Object convert​(java.lang.Object source,
                                                    java.lang.Class<?> targetType,
                                                    A annotation)
                                             throws ArgumentConversionException
        Convert the supplied source object into the supplied targetType, based on metadata in the provided annotation.
        Parameters:
        source - the source object to convert; may be null
        targetType - the target type the source object should be converted into; never null
        annotation - the annotation to process; never null
        Returns:
        the converted object; may be null but only if the target type is a reference type
        Throws:
        ArgumentConversionException - in case an error occurs during the conversion