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

org.javasimon.console.json.SimpleJS Maven / Gradle / Ivy

The newest version!
package org.javasimon.console.json;

import java.io.IOException;
import java.io.Writer;

import org.javasimon.console.text.Stringifier;

/**
 * JavaScript simple type.
 *
 * @author gquintana
 */
public class SimpleJS extends AnyJS {

	/** Simple value. */
	protected final T value;

	/** Value formatter. */
	private final Stringifier valueStringifier;

	/** Hidden constructor use factory methods instead. */
	public SimpleJS(T value, Stringifier valueStringifier) {
		this.value = value;
		this.valueStringifier = valueStringifier;
	}

	public T getValue() {
		return value;
	}

	@Override
	public void write(Writer writer) throws IOException {
		writer.write(valueStringifier.toString(value));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy