com.davfx.string.CompositeValueStringInput Maven / Gradle / Ivy
The newest version!
package com.davfx.string;
final class CompositeValueStringInput implements StringInput {
private final StringInput globalElementSeparator;
private final StringInput specificationSeparator;
private final StringInput keyValueListSeparator;
private final StringInput keyValueSeparator;
private final StringInput trim;
private final StringInput key;
private final StringInput wrappee;
public CompositeValueStringInput(StringInput globalElementSeparator, StringInput specificationSeparator, StringInput keyValueListSeparator, StringInput keyValueSeparator, StringInput trim, StringInput key, StringInput wrappee) {
this.globalElementSeparator = globalElementSeparator;
this.specificationSeparator = specificationSeparator;
this.keyValueListSeparator = keyValueListSeparator;
this.keyValueSeparator = keyValueSeparator;
this.trim = trim;
this.key = key;
this.wrappee = wrappee;
}
@Override
public String get(T h) {
String s = wrappee.get(h);
if (s == null) {
return null;
}
String ges = globalElementSeparator.get(h);
String ss = specificationSeparator.get(h);
String kvls = keyValueListSeparator.get(h);
String kvs = keyValueSeparator.get(h);
String t = trim.get(h);
String k = key.get(h);
CompositeString.SubCompositeString c = new CompositeString(ges, ss, kvls, kvs, Boolean.parseBoolean(t)).on(s);
return c.value(k);
}
}