com.crashnote.external.config.impl.ConfigNull 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;
/**
* This exists because sometimes null is not the same as missing. Specifically,
* if a value is set to null we can give a better error message (indicating
* where it was set to null) in case someone asks for the value. Also, null
* overrides values set "earlier" in the search path, while missing values do
* not.
*
*/
final class ConfigNull extends AbstractConfigValue implements Serializable {
private static final long serialVersionUID = 1L;
ConfigNull(final ConfigOrigin origin) {
super(origin);
}
@Override
public ConfigValueType valueType() {
return ConfigValueType.NULL;
}
@Override
public Object unwrapped() {
return null;
}
@Override
String transformToString() {
return "null";
}
@Override
protected void render(final StringBuilder sb, final int indent, final ConfigRenderOptions options) {
sb.append("null");
}
@Override
protected ConfigNull newCopy(final ConfigOrigin origin) {
return new ConfigNull(origin);
}
// serialization all goes through SerializedConfigValue
private Object writeReplace() throws ObjectStreamException {
return new SerializedConfigValue(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy