src/org/sonews/config/AbstractConfig.java
changeset 38 fdfc7225f799
parent 35 ed84c8bdd87b
child 49 8df94bfd3e2f
     1.1 --- a/src/org/sonews/config/AbstractConfig.java	Sun Aug 29 17:28:58 2010 +0200
     1.2 +++ b/src/org/sonews/config/AbstractConfig.java	Sun Aug 29 23:23:15 2010 +0200
     1.3 @@ -23,35 +23,34 @@
     1.4   * @author Christian Lins
     1.5   * @since sonews/0.5.0
     1.6   */
     1.7 -public abstract class AbstractConfig 
     1.8 +public abstract class AbstractConfig
     1.9  {
    1.10 -  
    1.11 -  public abstract String get(String key, String defVal);
    1.12 -  
    1.13 -  public int get(final String key, final int defVal)
    1.14 -  {
    1.15 -    return Integer.parseInt(
    1.16 -      get(key, Integer.toString(defVal)));
    1.17 -  }
    1.18 -  
    1.19 -  public boolean get(String key, boolean defVal)
    1.20 -  {
    1.21 -    String val = get(key, Boolean.toString(defVal));
    1.22 -    return Boolean.parseBoolean(val);
    1.23 -  }
    1.24  
    1.25 -  /**
    1.26 -   * Returns a long config value specified via the given key.
    1.27 -   * @param key
    1.28 -   * @param defVal
    1.29 -   * @return
    1.30 -   */
    1.31 -  public long get(String key, long defVal)
    1.32 -  {
    1.33 -    String val = get(key, Long.toString(defVal));
    1.34 -    return Long.parseLong(val);
    1.35 -  }
    1.36 +	public abstract String get(String key, String defVal);
    1.37  
    1.38 -  protected abstract void set(String key, String val);
    1.39 -  
    1.40 +	public int get(final String key, final int defVal)
    1.41 +	{
    1.42 +		return Integer.parseInt(
    1.43 +			get(key, Integer.toString(defVal)));
    1.44 +	}
    1.45 +
    1.46 +	public boolean get(String key, boolean defVal)
    1.47 +	{
    1.48 +		String val = get(key, Boolean.toString(defVal));
    1.49 +		return Boolean.parseBoolean(val);
    1.50 +	}
    1.51 +
    1.52 +	/**
    1.53 +	 * Returns a long config value specified via the given key.
    1.54 +	 * @param key
    1.55 +	 * @param defVal
    1.56 +	 * @return
    1.57 +	 */
    1.58 +	public long get(String key, long defVal)
    1.59 +	{
    1.60 +		String val = get(key, Long.toString(defVal));
    1.61 +		return Long.parseLong(val);
    1.62 +	}
    1.63 +
    1.64 +	protected abstract void set(String key, String val);
    1.65  }