Skip to content

Commit 0c04c0b

Browse files
committed
PoC implementing the existing Translate filter as a Java plugin.
This exists primarily to practice and demonstrate the capabilities of ConstructingObjectParser
1 parent c015a69 commit 0c04c0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

logstash-core/src/test/java/org/logstash/plugin/TranslateFilter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class TranslateFilterPlugin {
2323
TRANSLATE.declareConstructorArg("dictionary", (config) -> config);
2424
TRANSLATE.declareConstructorArg("dictionary_path", (object) -> Paths.get(ObjectTransforms.transformString(object)));
2525

26+
// These are all nice settings that are optional in the plugin.
2627
TRANSLATE.declareString("destination", TranslateFilter::setDestination);
2728
TRANSLATE.declareBoolean("exact", TranslateFilter::setExact);
2829
TRANSLATE.declareBoolean("override", TranslateFilter::setOverride);
@@ -92,6 +93,8 @@ private Object translate(Object input) {
9293

9394
@Override
9495
public Collection<Event> apply(Collection<Event> events) {
96+
// This implementation is incomplete. This test implementation primarily exists to demonstrate
97+
// the usage of the ConstructingObjectParser with a real plugin.
9598
for (Event event : events) {
9699
Object input = event.getField(source);
97100
if (input == null && fallback != null) {

0 commit comments

Comments
 (0)