Package org.mapfish.print.processor
Class ProcessorUtils
java.lang.Object
org.mapfish.print.processor.ProcessorUtils
Shared methods for working with processor.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getInputValueName
(String inputPrefix, com.google.common.collect.BiMap<String, String> inputMapper, String field) Calculate the name of the input value.static String
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
(Object output, Processor<?, ?> processor, Values values) Read the values from the output object and write them to the values object.
-
Method Details
-
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 objectOUT
- 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(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 processorprocessor
- the processor the output if fromvalues
- the object for sharing values between processors
-
getInputValueName
public static String getInputValueName(@Nullable String inputPrefix, @Nonnull com.google.common.collect.BiMap<String, String> inputMapper, @Nonnull String field) Calculate the name of the input value.- Parameters:
inputPrefix
- a nullable prefix to prepend to the name if non-null and non-emptyinputMapper
- the name mapperfield
- the field containing the value
-
getOutputValueName
public static String getOutputValueName(@Nullable String outputPrefix, @Nonnull Map<String, String> outputMapper, @Nonnull Field field) Calculate the name of the output value.- Parameters:
outputPrefix
- a nullable prefix to prepend to the name if non-null and non-emptyoutputMapper
- the name mapperfield
- the field containing the value
-