forked from stleary/JSON-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNull.java
More file actions
62 lines (54 loc) · 1.08 KB
/
Copy pathNull.java
File metadata and controls
62 lines (54 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package org.json;
/**
* JSONObject.NULL is equivalent to the value that JavaScript calls null, whilst Java's null is
* equivalent to the value that JavaScript calls undefined.
*/
public class Null
{
private static final Null INSTANCE = new Null();
public static Null getInstance()
{
return INSTANCE;
}
private Null()
{
}
/**
* There is only intended to be a single instance of the NULL object, so the clone method returns
* itself.
*
* @return NULL.
*/
@Override
protected final Object clone()
{
return this;
}
/**
* A Null object is equal to the null value and to itself.
*
* @param object
* An object to test for nullness.
* @return true if the object parameter is the JSONObject.NULL object or null.
*/
@Override
public boolean equals(Object object)
{
return object == null || object == this;
}
@Override
public int hashCode()
{
return 0;
}
/**
* Get the "null" string value.
*
* @return The string "null".
*/
@Override
public String toString()
{
return "null";
}
}