01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package org.apache.ivy.core.module.descriptor;
19:
20: import java.util.Map;
21:
22: /**
23: *
24: */
25: public abstract class AbstractArtifact implements Artifact {
26: public AbstractArtifact() {
27: }
28:
29: public boolean equals(Object obj) {
30: if (!(obj instanceof Artifact)) {
31: return false;
32: }
33: Artifact art = (Artifact) obj;
34: return getModuleRevisionId().equals(art.getModuleRevisionId())
35: && getPublicationDate() == null ? true
36: : getPublicationDate().equals(art.getPublicationDate())
37: && getName().equals(art.getName())
38: && getExt().equals(art.getExt())
39: && getType().equals(art.getType())
40: && getExtraAttributes().equals(
41: art.getExtraAttributes());
42: }
43:
44: public int hashCode() {
45: //CheckStyle:MagicNumber| OFF
46: int hash = 33;
47: hash = hash * 17 + getModuleRevisionId().hashCode();
48: if (getPublicationDate() != null) {
49: hash = hash * 17 + getPublicationDate().hashCode();
50: }
51: hash = hash * 17 + getName().hashCode();
52: hash = hash * 17 + getExt().hashCode();
53: hash = hash * 17 + getType().hashCode();
54: hash = hash * 17 + getExtraAttributes().hashCode();
55: //CheckStyle:MagicNumber| ON
56: return hash;
57: }
58:
59: public String toString() {
60: return String.valueOf(getId());
61: }
62:
63: public String getAttribute(String attName) {
64: return getId().getAttribute(attName);
65: }
66:
67: public Map getAttributes() {
68: return getId().getAttributes();
69: }
70:
71: public String getExtraAttribute(String attName) {
72: return getId().getExtraAttribute(attName);
73: }
74:
75: public Map getExtraAttributes() {
76: return getId().getExtraAttributes();
77: }
78:
79: public Map getQualifiedExtraAttributes() {
80: return getId().getQualifiedExtraAttributes();
81: }
82:
83: public String getStandardAttribute(String attName) {
84: return getId().getStandardAttribute(attName);
85: }
86:
87: public Map getStandardAttributes() {
88: return getId().getStandardAttributes();
89: }
90:
91: }
|