You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2002/08/22 21:28:37 UTC
[lang] NullObject
One of the classes I have in my utility library is a NullObject class. This
class gets used whenever I need to store/use a null, but can't because nulls
are disallowed. The instance thus acts as a placeholder.
This could be added to ObjectUtils, as a single instance is all that is
required. A static nested class is needed, as the instance must be
serializable.
public static final NullObject NULL = new NullObject();
public static class NullObject implements Serializable, Cloneable {
private UNullObject() {
super();
}
}
private readResolve() {
return ObjectUtils.NULL;
}
Thoughts?
Stephen
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>