@FunctionalInterface
public interface Transformer
Transformer is a routine that takes a key/value pair and
potentially alters one or both of them, prior to import.
Sometimes, raw data from a source must be modified before being imported into Concourse, for example:
| Modifier and Type | Method and Description |
|---|---|
default java.util.Map<java.lang.String,java.lang.Object> |
transform(java.util.Map<java.lang.String,java.lang.Object> object)
Transform all of the key/value pairs in the
object and returned
the merged result. |
java.util.Map<java.lang.String,java.lang.Object> |
transform(java.lang.String key,
java.lang.Object value)
Potentially transform the provided
key and value pair. |
default java.util.Map.Entry<java.lang.String,java.lang.Object> |
transform(java.lang.String key,
java.lang.String value)
Deprecated.
in version 1.1.0; scheduled to be removed in version 2.0.0.
Use
transform(String, Object) instead. |
@Nullable
@Deprecated
default java.util.Map.Entry<java.lang.String,java.lang.Object> transform(java.lang.String key,
java.lang.String value)
transform(String, Object) instead.key/value pair.
If no transformation should occur, it is acceptable to return
null to inform the caller that the import values are acceptable
in their passed in state.
Otherwise, the preferred pair should be wrapped in an Map.Entry
object.key - the raw key to potentially transformvalue - the raw value to potentially transform; in which case, it is
acceptable to return any kind of object, but it is recommended
to return an encoded String (i.e. don't return a
Link object, but return a
string that encodes a link (@record@) instead)Map.Entry object that contains the transformed
key/value pair or null if no
transformation occurreddefault java.util.Map<java.lang.String,java.lang.Object> transform(java.util.Map<java.lang.String,java.lang.Object> object)
object and returned
the merged result.
The result of the transformations will be merged using the
upsert merge strategy.
object - @Nullable
java.util.Map<java.lang.String,java.lang.Object> transform(java.lang.String key,
java.lang.Object value)
key and value pair.
There are four possible transformation scenarios:
null. In the other scenarios,
this method returns a Map which contains the data that will
replace the original key and value. So, if the
input parameters are part of a larger data map, the caller should
merge the data
from this map with the source data.
Even though the inputs to this method are simple, a Map is
returned to allow for complex transformations. For example,
Transformation#to(Object, Object) utility.
key - the raw key to potentially transformvalue - the raw value to potentially transform