View Javadoc

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.common;
17  
18  /**
19   * Defines a property to be selected by the user to include into the build meta
20   * data properties.
21   *
22   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
23   * @version $Revision:591 $
24   */
25  public final class Property
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    // --- members --------------------------------------------------------------
32  
33    /**
34     * The name of the system property to add to the build meta data properties.
35     */
36    private String name;
37  
38    /**
39     * The name of the property to be used in the build meta data properties. This
40     * allows to change the name of the property.
41     */
42    private String mappedName;
43  
44    /**
45     * The value provided for the property. No lookup is performed. Standard Maven
46     * properties are resolved.
47     */
48    private String value;
49  
50    /**
51     * The section the property is added to. If omitted or invalid, the property
52     * is added to the <code>build.misc</code> section.
53     * <p>
54     * Valid section identifiers are:
55     * </p>
56     * <ul>
57     * <li><code>build.scm</code></li>
58     * <li><code>build.dateAndVersion</code></li>
59     * <li><code>build.runtime</code></li>
60     * <li><code>build.java</code></li>
61     * <li><code>build.maven</code></li>
62     * </ul>
63     */
64    private String section;
65  
66    /**
67     * The label used for reports. If unset, the name of the property is used as a
68     * label.
69     */
70    private String label;
71  
72    // ****************************** Initializer *******************************
73  
74    // ****************************** Constructors ******************************
75  
76    // ****************************** Inner Classes *****************************
77  
78    // ********************************* Methods ********************************
79  
80    // --- init -----------------------------------------------------------------
81  
82    // --- get&set --------------------------------------------------------------
83  
84    /**
85     * Returns the name of the system property to add to the build meta data
86     * properties.
87     *
88     * @return the name of the system property to add to the build meta data
89     *         properties.
90     */
91    public String getName()
92    {
93      return name;
94    }
95  
96    /**
97     * Returns the name of the property in the build meta data properties. This
98     * allows change the name of the property.
99     *
100    * @return the name of the property in the build meta data properties. If the
101    *         mapped name is not given, the {@link #getName() name} is returned.
102    */
103   public String getMappedName()
104   {
105     return mappedName != null ? mappedName : getName();
106   }
107 
108   /**
109    * Returns the value provided for the property. No lookup is performed.
110    * Standard Maven properties are resolved.
111    *
112    * @return the value provided for the property.
113    */
114   public String getValue()
115   {
116     return value;
117   }
118 
119   /**
120    * Returns the section the property is added to. If omitted or invalid, the
121    * property is added to the <code>build.misc</code> section.
122    * <p>
123    * Valid section identifiers are:
124    * </p>
125    * <ul>
126    * <li><code>build.scm</code></li>
127    * <li><code>build.dateAndVersion</code></li>
128    * <li><code>build.runtime</code></li>
129    * <li><code>build.java</code></li>
130    * <li><code>build.maven</code></li>
131    * </ul>
132    *
133    * @return the section the property is added to.
134    */
135   public String getSection()
136   {
137     return section;
138   }
139 
140   /**
141    * Returns the label used for reports. If unset, the name of the property is
142    * used as a label.
143    *
144    * @return the label used for reports.
145    */
146   public String getLabel()
147   {
148     return label;
149   }
150 
151   // --- business -------------------------------------------------------------
152 
153   // --- object basics --------------------------------------------------------
154 
155 }