From 8ca67b9b64523812ebdba1427b2e0ae39a10b28e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 17 Jan 2016 09:12:45 +0000 Subject: [PATCH] Make {localize} binding more self-documenting --- source/net/filebot/format/DynamicBindings.java | 11 ++++++++++- source/net/filebot/format/MediaBindingBean.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/format/DynamicBindings.java b/source/net/filebot/format/DynamicBindings.java index 00adaf5b..7310d2ac 100644 --- a/source/net/filebot/format/DynamicBindings.java +++ b/source/net/filebot/format/DynamicBindings.java @@ -2,14 +2,18 @@ package net.filebot.format; import groovy.lang.GroovyObjectSupport; +import java.util.Arrays; import java.util.function.Function; +import java.util.stream.Stream; public class DynamicBindings extends GroovyObjectSupport { private Function map; + private String[] keys; - public DynamicBindings(Function map) { + public DynamicBindings(Function map, Stream keys) { this.map = map; + this.keys = keys.toArray(String[]::new); } @Override @@ -17,4 +21,9 @@ public class DynamicBindings extends GroovyObjectSupport { return map.apply(property); } + @Override + public String toString() { + return Arrays.toString(keys); + } + } diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index b9f31240..b392b94d 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -638,7 +638,7 @@ public class MediaBindingBean { } } return undefined(key); - }); + }, Language.availableLanguages().stream().map(Language::getName)); } @Define("bitrate")