/*******************************************************************************
 * Copyright (c) 2010-2014 Alexander Kerner. All rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package net.sf.kerner.utils;

import java.io.File;
import java.util.Locale;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * General utility class.
 * 
 * @author <a href="mailto:alex.kerner.24@googlemail.com">Alexander Kerner</a>
 * 
 */
public class Util {

    private final static Logger logger = LoggerFactory.getLogger(Util.class);

    /**
     * Number of CPUs that are available to this JVM.
     */
    public static final int NUM_CPUS = Runtime.getRuntime().availableProcessors();

    /**
     * {@link Locale} of current user, e.g. "de", "en" or "fr".
     */
    public static final Locale USER_LOCALE = new Locale(System.getProperty("user.language"));

    /**
     * The working directory is the location in the file system from where the
     * java command was invoked.
     */
    public static final File WORKING_DIR = new File(System.getProperty("user.dir"));

    public static void checkForNull(final Object... objects) throws NullPointerException {
        for (final Object o : objects) {
            if (o == null) {
                throw new NullPointerException();
            }
        }
    }

    /**
     * Load a property file as a resource stream and return the {@code version}
     * property.
     * 
     * @param clazz
     * @param propertiesFile
     * @return version string or {@code n/a} if property could not be read
     */
    public static String readVersionFromProperties(final Class<?> clazz, final String propertiesFile) {
        String result = "n/a";
        try {
            final Properties props = new Properties();
            props.load(clazz.getResourceAsStream(propertiesFile));
            result = props.getProperty("version");
        } catch (final Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }

    private Util() {

    }
}

@@ -142,18 +142,17 @@
 rved.%0A *
- 
 %0A
+
  * Licen
@@ -323,17 +323,16 @@
 se at%0A *
- 
 %0A *   ht
@@ -374,17 +374,16 @@
 E-2.0%0A *
- 
 %0A * Unle
@@ -973,17 +973,16 @@
 lass.%0A *
- 
 %0A * @aut
@@ -1055,17 +1055,16 @@
 r%3C/a%3E%0A *
- 
 %0A */%0Apub
@@ -1941,24 +1941,320 @@
    %7D%0A    %7D%0A%0A
+    public static String getToStringDelimiter() %7B%0A        return %22:%22;%0A    %7D%0A%0A    public static String getToStringPostFix(final Class%3C?%3E c) %7B%0A        return %22%22;%0A    %7D%0A%0A    public static String getToStringPreFix(final Class%3C?%3E c) %7B%0A        return c.getSimpleName() + getToStringDelimiter();%0A    %7D%0A%0A
     /**%0A    
@@ -2346,23 +2346,22 @@
 operty.%0A
+
      *
- 
 %0A     * 

Add Util#toString*.