griffon/core/ArtifactInfo.java

`ArtifactInfo.java`
`01 /* 02 * Copyright 2009-2012 the original author or authors. 03 * 04 * Licensed under the Apache License, Version 2.0 (the "License"); 05 * you may not use this file except in compliance with the License. 06 * You may obtain a copy of the License at 07 * 08 * http://www.apache.org/licenses/LICENSE-2.0 09 * 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 griffon.core; 18 19 /** 20 * Describes an artifact that can be handled by {@code ArtifactManager}.<p> 21 * This class is used for communication between {@code ArtifactManager} and 22 * {@code ArtifactHandler}s, and as such is considered to be of internal use. 23 * 24 * @author Andres Almiray 25 */ 26 public class ArtifactInfo { 27 private final Class clazz; 28 private final String type; 29 30 public ArtifactInfo(Class clazz, String type) { 31 this.clazz = clazz; 32 this.type = type; 33 } 34 35 public Class getClazz() { 36 return clazz; 37 } 38 39 public String getType() { 40 return type; 41 } 42 43 public String toString() { 44 return type + "[" + clazz.getName() + "]"; 45 } 46 47 public boolean equals(Object obj) { 48 if (this == obj) return true; 49 if (obj == null) return false; 50 if (!(obj instanceof ArtifactInfo)) return false; 51 52 ArtifactInfo other = (ArtifactInfo) obj; 53 return clazz.equals(other.clazz) && 54 type.equals(other.type); 55 } 56 57 public int hashCode() { 58 return (clazz.hashCode() * 37) + 59 (type.hashCode() * 31); 60 } 61 }`