Interface Transformer<PAYLOAD,CONTEXT>
-
- Type Parameters:
PAYLOAD- Type of the object to be transformedCONTEXT- Type used in the accumulator to identify current iteration (e.g., Integer representing idx of mutated char in a string)
- All Known Implementing Classes:
BitInByteArrTransformer,BooleanAsByteArrTransformer,BooleanAsStringTransformer,ByteArrByzantineValueTransformer,GatewayTransformer,IntegerAsStringTransformer,JsonObjectAsByteArrTransformer,JsonObjectAsStringTransformer,NullTransformer,RedisTimeoutExceptionTransformer,StringAsByteArrTransformer,StringBasicByzantineValueTransformer,StringByzantineValueTransformer,StringTransformer
public interface Transformer<PAYLOAD,CONTEXT>Returns a generic transformer interface that can be implemented in type-specific classes (e.g., StringTransformer).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.reflect.TypegetAccumulatorType()Returns Type representation of the accumulator.default Accumulator<PAYLOAD,CONTEXT>getInitialAccumulator()Returns initial accumulator used in the first transformation.Accumulator<PAYLOAD,CONTEXT>getInitialAccumulator(PAYLOAD referenceValue)Returns initial accumulator used in the first transformation.Accumulator<PAYLOAD,CONTEXT>getNextAccumulator()Returns accumulator of next transformation.java.lang.reflect.TypegetPayloadType()Returns Type of the payload.PAYLOADgetResult()Returns payload after applying the transformation.booleanhasNext()Returns whether current iteration has a successor.Transformer<PAYLOAD,CONTEXT>transform(PAYLOAD payload, Accumulator<PAYLOAD,CONTEXT> accumulator)Returns transformer instance containing the payload after applying the transformation.
-
-
-
Method Detail
-
transform
Transformer<PAYLOAD,CONTEXT> transform(PAYLOAD payload, Accumulator<PAYLOAD,CONTEXT> accumulator)
Returns transformer instance containing the payload after applying the transformation.- Parameters:
payload- Value to be transformedaccumulator- Accumulator of current iteration- Returns:
- Transformer
-
hasNext
boolean hasNext()
Returns whether current iteration has a successor.- Returns:
- boolean
-
getPayloadType
java.lang.reflect.Type getPayloadType()
Returns Type of the payload.- Returns:
- Type of the payload
-
getAccumulatorType
java.lang.reflect.Type getAccumulatorType()
Returns Type representation of the accumulator. This method is used to serialize the accumulator in Gson.- Returns:
- Type representation of the accumulator
-
getResult
PAYLOAD getResult()
Returns payload after applying the transformation. The transform method should be called at least once before this method.- Returns:
- Payload
-
getInitialAccumulator
Accumulator<PAYLOAD,CONTEXT> getInitialAccumulator(PAYLOAD referenceValue)
Returns initial accumulator used in the first transformation.- Parameters:
referenceValue- reference value used in the initial accumulator- Returns:
- Initial accumulator
-
getInitialAccumulator
default Accumulator<PAYLOAD,CONTEXT> getInitialAccumulator()
Returns initial accumulator used in the first transformation. The reference value is null.- Returns:
- Initial accumulator
-
getNextAccumulator
Accumulator<PAYLOAD,CONTEXT> getNextAccumulator()
Returns accumulator of next transformation.- Returns:
- Generic accumulator
-
-