View Javadoc

1   package org.apache.maven.plugin.war.util;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.model.Dependency;
23  
24  /**
25   * Holds a dependency and packaging information.
26   *
27   * @author Stephane Nicoll
28   * @version $Id: DependencyInfo.html 867902 2013-06-30 13:58:43Z olamy $
29   */
30  public class DependencyInfo
31  {
32  
33  
34      private final Dependency dependency;
35  
36      private String targetFileName;
37  
38      /**
39       * Creates a new instance.
40       *
41       * @param dependency the dependency
42       */
43      public DependencyInfo( Dependency dependency )
44      {
45          this.dependency = dependency;
46      }
47  
48      /**
49       * Returns the dependency.
50       *
51       * @return the dependency
52       */
53      public Dependency getDependency()
54      {
55          return dependency;
56      }
57  
58      /**
59       * Returns the target filen ame of the dependency. If no target file name
60       * is associated, returns <tt>null</tt>.
61       *
62       * @return the target file name or <tt>null</tt>
63       */
64      public String getTargetFileName()
65      {
66          return targetFileName;
67      }
68  
69      /**
70       * Sets the target file name.
71       *
72       * @param targetFileName the target file name
73       */
74      public void setTargetFileName( String targetFileName )
75      {
76          this.targetFileName = targetFileName;
77      }
78  
79      public boolean equals( Object o )
80      {
81          if ( this == o )
82          {
83              return true;
84          }
85          if ( o == null || getClass() != o.getClass() )
86          {
87              return false;
88          }
89  
90          DependencyInfo that = (DependencyInfo) o;
91  
92          if ( dependency != null ? !dependency.equals( that.dependency ) : that.dependency != null )
93          {
94              return false;
95          }
96  
97          return true;
98      }
99  
100     public int hashCode()
101     {
102         int result;
103         result = ( dependency != null ? dependency.hashCode() : 0 );
104         result = 31 * result + ( targetFileName != null ? targetFileName.hashCode() : 0 );
105         return result;
106     }
107 }