Subversion Repositories bacoAlunos

Rev

Rev 1306 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.utils;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;

/**
 * @author Jorge Machado
 * @date 29/Dez/2007
 * @time 1:47:22
 */

public class ConfigProperties extends jomm.utils.ConfigProperties
{

    private static ConfigProperties instance;


    public 1.5.0/docs/api/java/lang/String.html">String getPath()
    {
        return "/pt/estgp/estgweb/app.properties";
    }

    public static ConfigProperties getInstance()
    {
        if(instance == null)
            instance = new ConfigProperties();
        return instance;
    }

    /**
     * Get property and convert it to float
     *
     * @param property to get and convert
     * @return float value
     */

    public static float getFloatProperty(1.5.0/docs/api/java/lang/String.html">String property)
    {
        return getInstance().getFloat(property);
    }

    /**
     * Get property and convert it to short
     *
     * @param property to get and convert
     * @return float value
     */

    public static short getShortProperty(1.5.0/docs/api/java/lang/String.html">String property)
    {
        return getInstance().getShort(property);
    }

    /**
     * Get property and convert it to boolean
     *
     * @param property to get and convert
     * @return float value
     */

    public static boolean getBooleanProperty(1.5.0/docs/api/java/lang/String.html">String property)
    {
        return getInstance().getBoolean(property);
    }

    /**
     * Get property and convert it to int
     *
     * @param property to get and convert
     * @return float value
     */

    public static int getIntProperty(1.5.0/docs/api/java/lang/String.html">String property)
    {
        return getInstance().getInt(property);
    }


    /**
     *
     * @param property to load
     * @return property value
     */

    public static 1.5.0/docs/api/java/lang/String.html">String getProperty(1.5.0/docs/api/java/lang/String.html">String property)
    {
        return getInstance().getProp(property);
    }

    /**
     * @param propertyPrefix to load
     * @return a list of all property names hat starts with the given
     * prefix
     */

    public static List<String> getListProperties(1.5.0/docs/api/java/lang/String.html">String propertyPrefix)
    {
        return getInstance().getListProps(propertyPrefix);
    }

    /**
     * @param propertyPrefix to load
     * @return a list of all values hat starts with the given
     * prefix
     */

    public static List<String> getListValues(1.5.0/docs/api/java/lang/String.html">String propertyPrefix)
    {
        return getInstance().getListVals(propertyPrefix);
    }


    public static List<String> getListValuesByPrefix(1.5.0/docs/api/java/lang/String.html">String valuePrefix)
    {
        List<String> props = new ArrayList<String>();
        for (1.5.0/docs/api/java/util/Map.html">Map.Entry<Object,Object> property : getInstance().getProperties().entrySet())
        {
            if(((1.5.0/docs/api/java/lang/String.html">String)property.getValue()).startsWith(valuePrefix))
                props.add((1.5.0/docs/api/java/lang/String.html">String) property.getValue());
        }
        return props;
    }

    /**
     * @param propertyPrefix to load
     * @return a list of all values hat starts with the given
     * prefix
     */

    public static List<String> getListValuesOrderedByValue(1.5.0/docs/api/java/lang/String.html">String propertyPrefix)
    {
        return getInstance().getListValsOrderedByValue(propertyPrefix);
    }


    /**
     * @param propertyPrefix to load
     * @return a list of all values hat starts with the given
     * prefix
     */

    public static List<String> getListValuesOrderedByPropertyName(1.5.0/docs/api/java/lang/String.html">String propertyPrefix)
    {
        return getInstance().getListValsOrderedByPropertyName(propertyPrefix);
    }

}