Class ProcessorUtils


  • public final class ProcessorUtils
    extends java.lang.Object
    Shared methods for working with processor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getInputValueName​(java.lang.String inputPrefix, com.google.common.collect.BiMap<java.lang.String,​java.lang.String> inputMapper, java.lang.String field)
      Calculate the name of the input value.
      static java.lang.String getOutputValueName​(java.lang.String outputPrefix, java.util.Map<java.lang.String,​java.lang.String> outputMapper, java.lang.reflect.Field field)
      Calculate the name of the output value.
      static <IN,​OUT>
      IN
      populateInputParameter​(Processor<IN,​OUT> processor, Values values)
      Create the input object required by the processor and populate all the fields from the values object.
      static void writeProcessorOutputToValues​(java.lang.Object output, Processor<?,​?> processor, Values values)
      Read the values from the output object and write them to the values object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • populateInputParameter

        public static <IN,​OUT> IN populateInputParameter​(Processor<IN,​OUT> processor,
                                                               @Nonnull
                                                               Values values)
        Create the input object required by the processor and populate all the fields from the values object.

        If Processor.createInputParameter() returns an instance of values then the values object will be returned.

        Type Parameters:
        IN - type of the processor input object
        OUT - type of the processor output object
        Parameters:
        processor - the processor that the input object will be for.
        values - the object containing the values to put into the input object
      • writeProcessorOutputToValues

        public static void writeProcessorOutputToValues​(java.lang.Object output,
                                                        Processor<?,​?> processor,
                                                        Values values)
        Read the values from the output object and write them to the values object.
        Parameters:
        output - the output object from a processor
        processor - the processor the output if from
        values - the object for sharing values between processors
      • getInputValueName

        public static java.lang.String getInputValueName​(@Nullable
                                                         java.lang.String inputPrefix,
                                                         @Nonnull
                                                         com.google.common.collect.BiMap<java.lang.String,​java.lang.String> inputMapper,
                                                         @Nonnull
                                                         java.lang.String field)
        Calculate the name of the input value.
        Parameters:
        inputPrefix - a nullable prefix to prepend to the name if non-null and non-empty
        inputMapper - the name mapper
        field - the field containing the value
      • getOutputValueName

        public static java.lang.String getOutputValueName​(@Nullable
                                                          java.lang.String outputPrefix,
                                                          @Nonnull
                                                          java.util.Map<java.lang.String,​java.lang.String> outputMapper,
                                                          @Nonnull
                                                          java.lang.reflect.Field field)
        Calculate the name of the output value.
        Parameters:
        outputPrefix - a nullable prefix to prepend to the name if non-null and non-empty
        outputMapper - the name mapper
        field - the field containing the value