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

com.github.javaclub.toolbox.Ref Maven / Gradle / Ivy

There is a newer version: 2.7.44
Show newest version
/*
 * @(#)Ref.java	2017年7月26日
 *
 * Copyright (c) 2017. All Rights Reserved.
 *
 */

package com.github.javaclub.toolbox;

import java.io.Serializable;

/**
 * Ref
 *
 * @author Gerald Chen
 * @version $Id: Ref.java 2017年7月26日 3:27:11 Exp $
 */
public class Ref implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private T object;

	public Ref() {
	}
	
	public static  Ref create(T o) {
		Ref ref = new Ref();
		ref.setObject(o);
		return ref;
	}

	public T getObject() {
		return object;
	}

	public void setObject(T object) {
		this.object = object;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((object == null) ? 0 : object.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Ref other = (Ref) obj;
		if (object == null) {
			if (other.object != null)
				return false;
		} else if (!object.equals(other.object)) {
			return false;
		}
		return true;
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy