Class PropertyService


  • public class PropertyService
    extends Object

    Simple utility that provides methods to access properties. Note that some properties have to be provided in a predefined format within the properties file: java.util.Date: "dd.MM.yyyy HH:mm:ss" double: "0.00" float: "0.00" Furthermore it is important that the application that uses this service has to provide a property file at a predefined location within the library!

    Copyright 2010 (C) by Martin Ganserer

    Version:
    1.0.0
    Author:
    Martin Ganserer
    • Constructor Detail

      • PropertyService

        public PropertyService()
        Constructor
      • PropertyService

        public PropertyService​(String pathToFile)
        Constructor
        Parameters:
        pathToFile -
    • Method Detail

      • getStringProperty

        public String getStringProperty​(String name)
        Get a property of type String
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property doesn't exist
      • getIntProperty

        public int getIntProperty​(String name)
        Get a property of type int
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent an integer
      • getLongProperty

        public long getLongProperty​(String name)
        Get a property of type long
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a long
      • getDoubleProperty

        public double getDoubleProperty​(String name)
        Get a property of type double
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a double
      • getFloatProperty

        public float getFloatProperty​(String name)
        Get a property of type float
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a float
      • getCharProperty

        public char getCharProperty​(String name)
        Get a property of type char
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a character
      • getDateProperty

        public Date getDateProperty​(String name)
        Get a property of type java.util.Date
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a date
      • getBooleanProperty

        public boolean getBooleanProperty​(String name)
        Get a property of type boolean
        Parameters:
        name - the property name
        Returns:
        the property value
        Throws:
        IllegalPropertyValueException - if the property value doesn't represent a boolean