All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.davfx.string.CompositeValueStringInput Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.davfx.string;


public 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().withGlobalElementSeparator(ges).withSpecificationSeparator(ss).withKeyValueListSeparator(kvls).withKeyValueSeparator(kvs).trim(Boolean.parseBoolean(t)).on(s);
		return c.value(k);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy