com.esotericsoftware.yamlbeans.document.YamlScalar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zoomba.lang.core Show documentation
Show all versions of zoomba.lang.core Show documentation
ZoomBA is a multi paradigm Micro Language for JVM Scripting
used for business development and software testing
The newest version!
package com.esotericsoftware.yamlbeans.document;
import java.io.IOException;
import com.esotericsoftware.yamlbeans.YamlConfig.WriteConfig;
import com.esotericsoftware.yamlbeans.emitter.Emitter;
import com.esotericsoftware.yamlbeans.emitter.EmitterException;
import com.esotericsoftware.yamlbeans.parser.ScalarEvent;
public class YamlScalar extends YamlElement {
String value;
public YamlScalar() {
}
public YamlScalar(Object value) {
this.value = String.valueOf(value);
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if(anchor!=null) {
sb.append('&');
sb.append(anchor);
sb.append(' ');
}
sb.append(value);
if(tag!=null) {
sb.append(" !");
sb.append(tag);
}
return sb.toString();
}
@Override
public void emitEvent(Emitter emitter, WriteConfig config) throws EmitterException, IOException {
char style = 0; // TODO determine style
emitter.emit(new ScalarEvent(anchor, tag, new boolean[] {true, true}, value, style));
}
}