1 /* 2 CommonConstants.java 3 Creation date : 23/11/2009 4 Copyright © Benjamin Croizet (graffity2199@yahoo.fr) 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 or GNU Lesser General Public License as published by the 9 Free Software Foundation; either version 3 of the License, 10 or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received copies of the GNU General Public License 18 and GNU Lesser General Public License along with this program; 19 if not, write to the Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 http://www.fsf.org/licensing/licenses/gpl.html 22 http://www.gnu.org/licenses/lgpl.html 23 */ 24 25 package net.sourceforge.plantumldependency.common.constants; 26 27 import static java.lang.System.getProperty; 28 import static java.util.Arrays.asList; 29 import static java.util.Collections.unmodifiableSet; 30 import static java.util.logging.Level.CONFIG; 31 import static java.util.logging.Level.FINE; 32 import static java.util.logging.Level.FINER; 33 import static java.util.logging.Level.FINEST; 34 import static java.util.logging.Level.INFO; 35 import static java.util.logging.Level.SEVERE; 36 import static java.util.logging.Level.WARNING; 37 import static net.sourceforge.plantumldependency.common.constants.CharacterConstants.DOT_CHAR; 38 39 import java.io.File; 40 import java.util.Date; 41 import java.util.HashSet; 42 import java.util.Set; 43 import java.util.logging.Level; 44 45 import net.sourceforge.plantumldependency.common.utils.date.UnmodifiableDate; 46 47 /** 48 * The class which stores all useful constants as Strings. 49 * 50 * @author Benjamin Croizet (<a href="mailto:graffity2199@yahoo.fr>graffity2199@yahoo.fr</a>) 51 * @since 1.3.0 52 * @version 1.3.0 53 */ 54 public final class CommonConstants { 55 56 /** The blank string. */ 57 public static final String BLANK_STRING = ""; 58 59 /** The current directory. */ 60 public static final File CURRENT_DIRECTORY = new File(DOT_CHAR); 61 62 /** The first prime number used by Eclipse for implementing the hashcode() method. */ 63 public static final int HASHCODE_PRIME_NUMBER1 = 1231; 64 65 /** The second prime number used by Eclipse for implementing the hashcode() method. */ 66 public static final int HASHCODE_PRIME_NUMBER2 = 1237; 67 68 /** The system line separator. */ 69 public static final String LINE_SEPARATOR = getProperty("line.separator"); 70 71 /** The {@link Set} containing all log levels of the java logging API. */ 72 public static final Set < Level > LOG_LEVELS_SET = unmodifiableSet(new HashSet < Level >(asList(new Level[] { 73 SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST}))); 74 75 /** 76 * The -1 code which is often used when returning a method (for error, or end of file for 77 * instance). 78 */ 79 public static final int MINUS_ONE_RETURN_CODE = -1; 80 81 /** The date which represents the current instant time (at the loading time). */ 82 public static final Date NOW = new UnmodifiableDate(); 83 84 /** 85 * Private constructor to prevent from instantiation. 86 * 87 * @since 1.3.0 88 */ 89 private CommonConstants() { 90 super(); 91 } 92 }