com.dahuatech.hutool.json.JSONNull Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-common Show documentation
Show all versions of java-sdk-common Show documentation
Dahua ICC Open API SDK for Java
package com.dahuatech.hutool.json;
import java.io.Serializable;
/**
* 用于定义null
,与Javascript中null相对应
* Java中的null
值在js中表示为undefined。
*
* @author Looly
*/
public class JSONNull implements Serializable {
/**
* NULL
对象用于减少歧义来表示Java 中的null
* NULL.equals(null)
返回 true
.
* NULL.toString()
返回 "null"
.
*/
public static final JSONNull NULL = new JSONNull();
private static final long serialVersionUID = 2633815155870764938L;
/**
* 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. 对象与其本身和null
值相等
*
* @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 super.hashCode();
}
/**
* Get the "null" string value. 获得“null”字符串
*
* @return The string "null".
*/
@Override
public String toString() {
return "null";
}
}