public class PrebuiltTransforms extends Object
Modifier and Type | Method and Description |
---|---|
static DocumentTransform |
copyMetadata(Map<String,String> config)
Returns a transform that copies metadata values from one key to another.
|
static DocumentTransform |
deleteMetadata(Map<String,String> config)
Returns a transform that deletes metadata keys.
|
static DocumentTransform |
moveMetadata(Map<String,String> config)
Returns a transform that moves metadata values from one key to another.
|
static DocumentTransform |
replaceMetadata(Map<String,String> config)
Returns a transform that preforms string replacements within metadata
values.
|
public static DocumentTransform copyMetadata(Map<String,String> config)
"overwrite"
key can be set to "true"
to cause the
destination to be replaced; otherwise the destination key is supplemented.
Copies are defined by pairs of "X.from"
and "X.to"
configuration entries (where X
is an integer). The value for each
is a metadata key. Copies are applied in the increasing order of the
integers.
Example configuration:
overwrite=false
3.from=colour
3.to=color
5.from=author
5.to=contributors
public static DocumentTransform moveMetadata(Map<String,String> config)
copyMetadata(java.util.Map<java.lang.String, java.lang.String>)
, except that the source keys are removed. If the source key
has no metadata values then the destination is left as-is.public static DocumentTransform deleteMetadata(Map<String,String> config)
"keyX"
configuration entries (where X
is an
integer).
Example configuration:
key2=sensitive
key4=unhelpful
public static DocumentTransform replaceMetadata(Map<String,String> config)
"keyX"
configuration entries (where X
is an
integer). The "overwrite"
configuration key can be set to "false"
to cause the original string to be left intact; otherwise the
original string is replaced.
The needle to be found is configured via a "string"
or "pattern"
configuration key. string
's value is treated as a
literal string to be found whereas pattern
's value is treated as
a regular expression. The replacement is defined by "replacement"
and is interpreted as a literal string if "string"
was provided
and a regular expression replacement if "pattern"
was provided.
Example configuration:
overwrite=false
key1=favorite
key5=least favorite
pattern=(Java|C|Perl)
replacement=$1 (but it should be x86 assembler)