1 /*
2 * Copyright 2006-2012 smartics, Kronseder & Reiner GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package de.smartics.maven.plugin.buildmetadata.scm.maven;
17
18 import java.util.Date;
19
20 import org.apache.maven.scm.ScmVersion;
21
22 /**
23 * The revision implementation for the Maven SCM.
24 *
25 * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
26 * @version $Revision:591 $
27 */
28 public final class MavenRevision extends StringRevision
29 {
30 // ********************************* Fields *********************************
31
32 // --- constants ------------------------------------------------------------
33
34 /**
35 * The class version identifier.
36 * <p>
37 * The value of this constant is {@value}.
38 */
39 private static final long serialVersionUID = 1L;
40
41 // --- members --------------------------------------------------------------
42
43 /**
44 * The type of the revision. May be for instance trunk, branch or tag.
45 */
46 private final String type;
47
48 // ****************************** Initializer *******************************
49
50 // ****************************** Constructors ******************************
51
52 /**
53 * Default constructor.
54 *
55 * @param version the SCM version provided by Maven.
56 * @param date the revision date.
57 * @see de.smartics.maven.plugin.buildmetadata.scm.maven.StringRevision#StringRevision(java.lang.String,
58 * java.util.Date)
59 */
60 public MavenRevision(final ScmVersion version, final Date date)
61 {
62 super(version.getName(), date);
63 this.type = version.getType();
64 }
65
66 // ****************************** Inner Classes *****************************
67
68 // ********************************* Methods ********************************
69
70 // --- init -----------------------------------------------------------------
71
72 // --- get&set --------------------------------------------------------------
73
74 /**
75 * Returns the type of the revision. May be for instance trunk, branch or tag.
76 *
77 * @return the type of the revision.
78 */
79 public String getType()
80 {
81 return type;
82 }
83
84 // --- business -------------------------------------------------------------
85
86 // --- object basics --------------------------------------------------------
87
88 /**
89 * {@inheritDoc}
90 */
91 public String toString()
92 {
93 return super.toString() + " (" + type + ')';
94 }
95 }