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  class MojoKey
26      extends ProjectKey
27  {
28      private String goal;
29  
30      private String executionId;
31  
32      private String phase;
33  
34      public MojoKey( String groupId, String artifactId, String version, String goal, String executionId,
35                      String lifeCyclePhase )
36      {
37          super( groupId, artifactId, version );
38          this.goal = goal;
39          this.executionId = executionId;
40          this.phase = lifeCyclePhase;
41      }
42  
43      public String getGoal()
44      {
45          return goal;
46      }
47  
48      public void setGoal( String goal )
49      {
50          this.goal = goal;
51      }
52  
53      public String getExecutionId()
54      {
55          return executionId;
56      }
57  
58      public void setExecutionId( String executionId )
59      {
60          this.executionId = executionId;
61      }
62  
63      public String getPhase()
64      {
65          return phase;
66      }
67  
68      public void setPhase( String phase )
69      {
70          this.phase = phase;
71      }
72  
73      public String getFullId()
74      {
75          return super.getId() + ":" + getGoal() + ":" + getExecutionId();
76      }
77  
78      public int hashCode()
79      {
80          final int prime = 31;
81          int result = super.hashCode();
82          result = prime * result + ( ( executionId == null ) ? 0 : executionId.hashCode() );
83          result = prime * result + ( ( goal == null ) ? 0 : goal.hashCode() );
84          result = prime * result + ( ( phase == null ) ? 0 : phase.hashCode() );
85          return result;
86      }
87  
88      public final boolean equals( Object obj )
89      {
90          if ( this == obj )
91              return true;
92          if ( !super.equals( obj ) )
93              return false;
94          if ( getClass() != obj.getClass() )
95              return false;
96          MojoKey other = (MojoKey) obj;
97          if ( executionId == null )
98          {
99              if ( other.executionId != null )
100                 return false;
101         }
102         else if ( !executionId.equals( other.executionId ) )
103             return false;
104         if ( goal == null )
105         {
106             if ( other.goal != null )
107                 return false;
108         }
109         else if ( !goal.equals( other.goal ) )
110             return false;
111         if ( phase == null )
112         {
113             if ( other.phase != null )
114                 return false;
115         }
116         else if ( !phase.equals( other.phase ) )
117             return false;
118         return true;
119     }
120 
121 }