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

gw.util.Reference Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.util;

public class Reference {

  T _value;

  public Reference(T value) {
    _value = value;
  }

  public Reference() {
  }

  public T get() {
    return _value;
  }

  public void set(T value) {
    _value = value;
  }

  public static  Reference make(T v) {
    return new Reference(v);
  }

  public boolean equals( Object o )
  {
    if( this == o )
    {
      return true;
    }
    if( !(o instanceof Reference) )
    {
      return false;
    }

    Reference ref = (Reference)o;

    return !(_value != null ? !_value.equals(ref._value) : ref._value != null);

  }

  public int hashCode()
  {
    int result;
    result = (_value != null ? _value.hashCode() : 0);
    return result;
  }

  @Override
  public String toString()
  {
    return "(" + _value + ")";
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy