Fixed warnings and updated some JavaDoc.

This commit is contained in:
Joel Leitch 2008-12-01 01:40:11 +00:00
parent 50dd475eb8
commit b9e81f93c1
2 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,7 @@ public final class JsonNull extends JsonElement {
private static final JsonNull INSTANCE = new JsonNull(true); private static final JsonNull INSTANCE = new JsonNull(true);
/** /**
* @deprecated use the creation method, {@link #createJsonNull()}, instead. * @deprecated Instead, use the creation method, {@link #createJsonNull()}.
*/ */
@Deprecated @Deprecated
public JsonNull() { public JsonNull() {
@ -59,7 +59,14 @@ public final class JsonNull extends JsonElement {
public boolean equals(Object other) { public boolean equals(Object other) {
return other instanceof JsonNull; return other instanceof JsonNull;
} }
/**
* Creation method used to return an instance of a {@link JsonNull}. To reduce the memory
* footprint, a single object has been created for this class; therefore the same instance is
* being returned for each invocation of this method.
*
* @return a instance of a {@link JsonNull}
*/
public static JsonNull createJsonNull() { public static JsonNull createJsonNull() {
return INSTANCE; return INSTANCE;
} }

View File

@ -139,7 +139,7 @@ public class NullObjectAndFieldTest extends TestCase {
public JsonElement serialize(ClassWithObjects src, Type typeOfSrc, public JsonElement serialize(ClassWithObjects src, Type typeOfSrc,
JsonSerializationContext context) { JsonSerializationContext context) {
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.add("bag", new JsonNull()); obj.add("bag", JsonNull.createJsonNull());
return obj; return obj;
} }
} }