001    package org.apache.archiva.rest.api.model;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import javax.xml.bind.annotation.XmlRootElement;
023    import java.io.Serializable;
024    
025    @XmlRootElement( name = "dependency" )
026    public class Dependency
027        implements Serializable
028    {
029        private String groupId;
030    
031        private String artifactId;
032    
033        private String version;
034    
035        private String classifier;
036    
037        private String type;
038    
039        private String scope;
040    
041        public Dependency()
042        {
043            // no op
044        }
045    
046    
047        public Dependency( String groupId, String artifactId, String version, String classifier, String type, String scope )
048        {
049            this.groupId = groupId;
050            this.artifactId = artifactId;
051            this.version = version;
052            this.classifier = classifier;
053            this.type = type;
054            this.scope = scope;
055        }
056    
057        public String getGroupId()
058        {
059            return groupId;
060        }
061    
062        public void setGroupId( String groupId )
063        {
064            this.groupId = groupId;
065        }
066    
067        public String getArtifactId()
068        {
069            return artifactId;
070        }
071    
072        public void setArtifactId( String artifactId )
073        {
074            this.artifactId = artifactId;
075        }
076    
077        public String getVersion()
078        {
079            return version;
080        }
081    
082        public void setVersion( String version )
083        {
084            this.version = version;
085        }
086    
087        public String getClassifier()
088        {
089            return classifier;
090        }
091    
092        public void setClassifier( String classifier )
093        {
094            this.classifier = classifier;
095        }
096    
097        public String getType()
098        {
099            return type;
100        }
101    
102        public void setType( String type )
103        {
104            this.type = type;
105        }
106    
107        public String getScope()
108        {
109            return scope;
110        }
111    
112        public void setScope( String scope )
113        {
114            this.scope = scope;
115        }
116    
117        @Override
118        public String toString()
119        {
120            return "Dependency{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='"
121                + version + '\'' + ", classifier='" + classifier + '\'' + ", type='" + type + '\'' + ", scope='" + scope
122                + '\'' + '}';
123        }
124    
125        @Override
126        public boolean equals( Object o )
127        {
128            if ( this == o )
129            {
130                return true;
131            }
132            if ( o == null || getClass() != o.getClass() )
133            {
134                return false;
135            }
136    
137            Dependency that = (Dependency) o;
138    
139            if ( !artifactId.equals( that.artifactId ) )
140            {
141                return false;
142            }
143            if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
144            {
145                return false;
146            }
147            if ( !groupId.equals( that.groupId ) )
148            {
149                return false;
150            }
151            if ( scope != null ? !scope.equals( that.scope ) : that.scope != null )
152            {
153                return false;
154            }
155            if ( type != null ? !type.equals( that.type ) : that.type != null )
156            {
157                return false;
158            }
159            if ( !version.equals( that.version ) )
160            {
161                return false;
162            }
163    
164            return true;
165        }
166    
167        @Override
168        public int hashCode()
169        {
170            int result = groupId.hashCode();
171            result = 31 * result + artifactId.hashCode();
172            result = 31 * result + version.hashCode();
173            result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
174            result = 31 * result + ( type != null ? type.hashCode() : 0 );
175            result = 31 * result + ( scope != null ? scope.hashCode() : 0 );
176            return result;
177        }
178    }