blob: 12ffa276c470bffa08bc1db4a999ab7a6e583afb [file] [log] [blame]
Richard S. Hall6fe36b42009-07-13 13:25:46 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20package standalone;
21
22import java.util.Properties;
23
24import org.apache.commons.lang.WordUtils;
25
26/**
27 * TODO write javadoc
28 */
29public class Main {
30 /**
31 * Returns the version of the project
32 * @return a string representation of the version, null if the version could not be retreived
33 */
34 public static String getVersion() {
35 Properties p = new Properties();
36 try {
37 p.load(Main.class.getResourceAsStream("/version.properties"));
38 String version = p.getProperty("version");
39 if (version != null) {
40 return String.valueOf(Integer.parseInt(version));
41 }
42 } catch (Exception e) {
43 e.printStackTrace();
44 }
45 return null;
46 }
47
48 /**
49 * Return the same string with all words capitalized.
50 * @param str the string conatining the words to capitalize
51 * @return null if the string was null, the string with all words capitalized otherwise
52 */
53 public static String capitalizeWords(String str) {
54 System.out.println(" [" + Main.class.getName() + "] capitalizing string \"" + str + "\" using " + WordUtils.class.getName());
55 return WordUtils.capitalizeFully(str);
56 }
57 public static void main(String[] args) {
58 String message="sentence to capitalize";
59 System.out.println("standard message : " + message);
60 System.out.println("capitalized message : " + capitalizeWords(message));
61 }
62}