All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commons.box.app.SafeObject Maven / Gradle / Ivy

The newest version!
package commons.box.app;

import java.io.Serializable;
import java.util.Objects;

/**
 * 安全对象 用于包含目标值 其中目标值不为空
 */
public class SafeObject implements Serializable {
    private final T object;

    public SafeObject() {
        this.object = null;
    }

    public SafeObject(T object) {
        this.object = object;
    }

    public T getObject() {
        return object;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SafeObject that = (SafeObject) o;
        return Objects.equals(object, that.object);
    }

    @Override
    public int hashCode() {
        return Objects.hash(object);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy