1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package signature.model.impl; 18 19 import signature.model.IClassDefinition; 20 import signature.model.IClassReference; 21 22 import java.io.Serializable; 23 24 @SuppressWarnings("serial") 25 public class SigClassReference implements IClassReference, Serializable { 26 27 private final IClassDefinition definition; 28 SigClassReference(IClassDefinition definition)29 public SigClassReference(IClassDefinition definition) { 30 this.definition = definition; 31 } 32 getClassDefinition()33 public IClassDefinition getClassDefinition() { 34 return definition; 35 } 36 37 @Override equals(Object obj)38 public boolean equals(Object obj) { 39 return SigClassReference.equals(this, obj); 40 } 41 equals(IClassReference thiz, Object that)42 public static boolean equals(IClassReference thiz, Object that) { 43 if (that instanceof IClassReference) { 44 return thiz.getClassDefinition().equals( 45 ((IClassReference) that).getClassDefinition()); 46 } 47 return false; 48 } 49 50 @Override hashCode()51 public int hashCode() { 52 return SigClassReference.hashCode(this); 53 } 54 hashCode(IClassReference thiz)55 public static int hashCode(IClassReference thiz) { 56 return thiz.getClassDefinition().hashCode(); 57 } 58 59 @Override toString()60 public String toString() { 61 return SigClassReference.toString(this); 62 } 63 toString(IClassReference thiz)64 public static String toString(IClassReference thiz) { 65 return "-> " + thiz.getClassDefinition().getQualifiedName(); 66 } 67 } 68