View Javadoc

1   /*
2    * Created on 23/08/2004
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package net.sourceforge.jparam.conversion;
8   
9   
10  class ConverterKey {
11  	Class sourceType;
12  	Class targetType;
13  
14  	public ConverterKey(Class sourceType, Class targetType) {
15  		super();
16  		this.sourceType = sourceType;
17  		this.targetType = targetType;
18  	}
19  
20  	public String toString() {
21  		return sourceType.getName() + "->" + targetType.getName();
22  	}
23  
24  	public int hashCode() {
25  		return sourceType.hashCode() * 37 + targetType.hashCode();
26  	}
27  
28  	public boolean equals(Object obj) {
29  		if (obj.getClass().equals(ConverterKey.class)) {
30  			ConverterKey other = (ConverterKey) obj;
31  			return other.sourceType.equals(sourceType)
32  					&& other.targetType.equals(targetType);
33  		}
34  
35  		return false;
36  	}
37  }