]>
Commit | Line | Data |
---|---|---|
1 | /*\r | |
2 | * Copyright (C) 2008 Google Inc.\r | |
3 | *\r | |
4 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
5 | * you may not use this file except in compliance with the License.\r | |
6 | * You may obtain a copy of the License at\r | |
7 | *\r | |
8 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
9 | *\r | |
10 | * Unless required by applicable law or agreed to in writing, software\r | |
11 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
13 | * See the License for the specific language governing permissions and\r | |
14 | * limitations under the License.\r | |
15 | */\r | |
16 | \r | |
17 | package com.google.gson;\r | |
18 | \r | |
19 | /**\r | |
20 | * A class representing a Json {@code null} value.\r | |
21 | *\r | |
22 | * @author Inderjeet Singh\r | |
23 | * @author Joel Leitch\r | |
24 | * @since 1.2\r | |
25 | */\r | |
26 | public final class JsonNull extends JsonElement {\r | |
27 | /**\r | |
28 | * singleton for JsonNull\r | |
29 | *\r | |
30 | * @since 1.8\r | |
31 | */\r | |
32 | public static final JsonNull INSTANCE = new JsonNull();\r | |
33 | \r | |
34 | /**\r | |
35 | * Creates a new JsonNull object.\r | |
36 | * Deprecated since Gson version 1.8. Use {@link #INSTANCE} instead\r | |
37 | */\r | |
38 | @Deprecated\r | |
39 | public JsonNull() {\r | |
40 | // Do nothing\r | |
41 | }\r | |
42 | \r | |
43 | @Override\r | |
44 | JsonNull deepCopy() {\r | |
45 | return INSTANCE;\r | |
46 | }\r | |
47 | \r | |
48 | /**\r | |
49 | * All instances of JsonNull have the same hash code since they are indistinguishable\r | |
50 | */\r | |
51 | @Override\r | |
52 | public int hashCode() {\r | |
53 | return JsonNull.class.hashCode();\r | |
54 | }\r | |
55 | \r | |
56 | /**\r | |
57 | * All instances of JsonNull are the same\r | |
58 | */\r | |
59 | @Override\r | |
60 | public boolean equals(Object other) {\r | |
61 | return this == other || other instanceof JsonNull;\r | |
62 | }\r | |
63 | }\r |