1 /*
2 * Copyright 2012-2013 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.properties.spi.core.metadata.projectdoc;
17
18 import java.io.Serializable;
19
20 /**
21 * Helper to parse projectdoc annotations.
22 */
23 public final class AnnotationHelper implements Serializable
24 {
25 // ********************************* Fields *********************************
26
27 // --- constants ------------------------------------------------------------
28
29 /**
30 * The class version identifier.
31 */
32 private static final long serialVersionUID = 1L;
33
34 // --- members --------------------------------------------------------------
35
36 // ****************************** Initializer *******************************
37
38 // ****************************** Constructors ******************************
39
40 /**
41 * Default constructor.
42 */
43 public AnnotationHelper()
44 {
45 }
46
47 // ****************************** Inner Classes *****************************
48
49 // ********************************* Methods ********************************
50
51 // --- init -----------------------------------------------------------------
52
53 // --- get&set --------------------------------------------------------------
54
55 // --- business -------------------------------------------------------------
56
57 /**
58 * Helper to normalize an annotation value.
59 *
60 * @param object the information to normalize.
61 * @return the normalized string.
62 */
63 public String normalizeString(final Object object)
64 {
65 final String value = String.valueOf(object).trim();
66 final int lastIndex = value.length() - 1;
67 if (value.startsWith("\"") && lastIndex > 0)
68 {
69 return value.substring(1, lastIndex);
70 }
71 return value;
72 }
73
74 // --- object basics --------------------------------------------------------
75
76 }