View Javadoc

1   package de.matthias_burbach.deputy.core.rule;
2   
3   /***
4    * @author Matthias Burbach
5    */
6   public class ReplacementRule extends Rule {
7       /***
8        * The group id of the artifact to be replaced.
9        */
10      private String displacedGroupId;
11  
12      /***
13       * The id of the artifact to be replaced.
14       */
15      private String displacedArtifactId;
16  
17      /***
18       * The version of the artifact to be replaced.
19       * Can be <code>null</code> if all versions shall be replaced.
20       */
21      private String displacedVersion;
22  
23  
24      /***
25       * @return Returns the displacedArtifactId.
26       */
27      public String getDisplacedArtifactId() {
28          return displacedArtifactId;
29      }
30  
31      /***
32       * @param displacedArtifactId The displacedArtifactId to set.
33       */
34      public void setDisplacedArtifactId(final String displacedArtifactId) {
35          this.displacedArtifactId = displacedArtifactId;
36      }
37  
38      /***
39       * @return Returns the displacedGroupId.
40       */
41      public String getDisplacedGroupId() {
42          return displacedGroupId;
43      }
44  
45      /***
46       * @param displacedGroupId The displacedGroupId to set.
47       */
48      public void setDisplacedGroupId(final String displacedGroupId) {
49          this.displacedGroupId = displacedGroupId;
50      }
51  
52      /***
53       * @return Returns the displacedVersion.
54       */
55      public String getDisplacedVersion() {
56          return displacedVersion;
57      }
58  
59      /***
60       * @param displacedVersion The displacedVersion to set.
61       */
62      public void setDisplacedVersion(final String displacedVersion) {
63          this.displacedVersion = displacedVersion;
64      }
65  
66      /*(non-Javadoc)
67       * @see java.lang.Object#toString()
68       */
69      /***
70       * {@inheritDoc}
71       */
72      public String toString() {
73          StringBuffer result = new StringBuffer("Replace ");
74          result.append(getDisplacedGroupId());
75          result.append("/" + getDisplacedArtifactId());
76          if (getDisplacedVersion() != null) {
77              result.append("-" + getDisplacedVersion());
78          }
79          result.append(" with ");
80          result.append(getGroupId());
81          result.append("/" + getArtifactId());
82          if (getVersion() != null) {
83              result.append("-" + getVersion());
84          }
85          return result.toString();
86      }
87  }