Make {localize} binding more self-documenting

This commit is contained in:
Reinhard Pointner 2016-01-17 09:12:45 +00:00
parent a226a4de0f
commit 8ca67b9b64
2 changed files with 11 additions and 2 deletions

View File

@ -2,14 +2,18 @@ package net.filebot.format;
import groovy.lang.GroovyObjectSupport; import groovy.lang.GroovyObjectSupport;
import java.util.Arrays;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Stream;
public class DynamicBindings extends GroovyObjectSupport { public class DynamicBindings extends GroovyObjectSupport {
private Function<String, Object> map; private Function<String, Object> map;
private String[] keys;
public DynamicBindings(Function<String, Object> map) { public DynamicBindings(Function<String, Object> map, Stream<String> keys) {
this.map = map; this.map = map;
this.keys = keys.toArray(String[]::new);
} }
@Override @Override
@ -17,4 +21,9 @@ public class DynamicBindings extends GroovyObjectSupport {
return map.apply(property); return map.apply(property);
} }
@Override
public String toString() {
return Arrays.toString(keys);
}
} }

View File

@ -638,7 +638,7 @@ public class MediaBindingBean {
} }
} }
return undefined(key); return undefined(key);
}); }, Language.availableLanguages().stream().map(Language::getName));
} }
@Define("bitrate") @Define("bitrate")