001package net.gdface.thrift;
002
003import java.lang.reflect.Type;
004
005public class TypeValue{
006        final Type type;
007        final Object value;
008        TypeValue(Type type, Object value) {
009                super();
010                this.type = type;
011                this.value = value;
012        }
013        @Override
014        public int hashCode() {
015                final int prime = 31;
016                int result = 1;
017                result = prime * result + ((type == null) ? 0 : type.hashCode());
018                result = prime * result + ((value == null) ? 0 : value.hashCode());
019                return result;
020        }
021        @Override
022        public boolean equals(Object obj) {
023                if (this == obj) {
024                        return true;
025                }
026                if (obj == null) {
027                        return false;
028                }
029                if (getClass() != obj.getClass()) {
030                        return false;
031                }
032                TypeValue other = (TypeValue) obj;
033                if (type == null) {
034                        if (other.type != null) {
035                                return false;
036                        }
037                } else if (!type.equals(other.type)) {
038                        return false;
039                }
040                if (value == null) {
041                        if (other.value != null) {
042                                return false;
043                        }
044                } else if (!value.equals(other.value)) {
045                        return false;
046                }
047                return true;
048        }
049        @Override
050        public String toString() {
051                StringBuilder builder = new StringBuilder();
052                builder.append("TypeValue [type=").append(type).append(", value=").append(value).append("]");
053                return builder.toString();
054        }
055}