View Javadoc
1   package com.soebes.maven.extensions;
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  /**
23   * @author Karl Heinz Marbaise <a href="mailto:kama@soebes.de">kama@soebes.de</a>
24   */
25  final class GoalKey
26      extends ProjectKey
27  {
28      final private String goal;
29  
30      final private String executionId;
31  
32      public GoalKey( final String groupId, final String artifactId, final String version, final String goal, final String executionId )
33      {
34          super( groupId, artifactId, version );
35          this.goal = goal;
36          this.executionId = executionId;
37      }
38  
39      public String getGoal()
40      {
41          return goal;
42      }
43  
44      public String getExecutionId()
45      {
46          return executionId;
47      }
48  
49      public String getFullId()
50      {
51          return super.getId() + ":" + getGoal() + ":" + getExecutionId();
52      }
53  
54      @Override
55      public int hashCode()
56      {
57          final int prime = 31;
58          int result = super.hashCode();
59          result = prime * result + ( ( executionId == null ) ? 0 : executionId.hashCode() );
60          result = prime * result + ( ( goal == null ) ? 0 : goal.hashCode() );
61          return result;
62      }
63  
64      @Override
65      public boolean equals( Object obj )
66      {
67          if ( this == obj )
68          {
69              return true;
70          }
71          if ( !super.equals( obj ) )
72          {
73              return false;
74          }
75          if ( !( obj instanceof GoalKey ) )
76          {
77              return false;
78          }
79          GoalKey other = (GoalKey) obj;
80          if ( executionId == null )
81          {
82              if ( other.executionId != null )
83              {
84                  return false;
85              }
86          }
87          else if ( !executionId.equals( other.executionId ) )
88          {
89              return false;
90          }
91          if ( goal == null )
92          {
93              if ( other.goal != null )
94              {
95                  return false;
96              }
97          }
98          else if ( !goal.equals( other.goal ) )
99          {
100             return false;
101         }
102         return true;
103     }
104 
105 }