com.crashnote.external.config.impl.ConfigString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crashnote-appengine Show documentation
Show all versions of crashnote-appengine Show documentation
Reports exceptions from Java apps on Appengine to crashnote.com
/**
* Copyright (C) 2011-2012 Typesafe Inc.
*/
package com.crashnote.external.config.impl;
import java.io.ObjectStreamException;
import java.io.Serializable;
import com.crashnote.external.config.ConfigOrigin;
import com.crashnote.external.config.ConfigRenderOptions;
import com.crashnote.external.config.ConfigValueType;
final class ConfigString extends AbstractConfigValue implements Serializable {
private static final long serialVersionUID = 1L;
final private String value;
ConfigString(final ConfigOrigin origin, final String value) {
super(origin);
this.value = value;
}
@Override
public ConfigValueType valueType() {
return ConfigValueType.STRING;
}
@Override
public String unwrapped() {
return value;
}
@Override
String transformToString() {
return value;
}
@Override
protected void render(final StringBuilder sb, final int indent, final ConfigRenderOptions options) {
final String rendered;
if (options.getJson())
rendered = ConfigImplUtil.renderJsonString(value);
else
rendered = ConfigImplUtil.renderStringUnquotedIfPossible(value);
sb.append(rendered);
}
@Override
protected ConfigString newCopy(final ConfigOrigin origin) {
return new ConfigString(origin, value);
}
// serialization all goes through SerializedConfigValue
private Object writeReplace() throws ObjectStreamException {
return new SerializedConfigValue(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy