Changeset 1685


Ignore:
Timestamp:
03/09/08 14:13:40 (7 years ago)
Author:
th-schwarz
Message:

added #setProperty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/PropertiesLoader.java

    r1683 r1685  
    2626import java.util.Properties; 
    2727 
     28import net.fckeditor.tool.Utils; 
     29 
    2830import org.slf4j.Logger; 
    2931import org.slf4j.LoggerFactory; 
     
    3335 * The main default file is 'default.properties' in the deepth of the classpath and should be 
    3436 * untouched. If there is a file named 'fckeditor.properties' in the root of the classpath, it will 
    35  * be loaded. Values which are loaded before, will be overwritten. 
     37 * be loaded. Values which are loaded before, will be overwritten.<br> 
     38 * If you won't use an extra properties file to adjust the defaults, you can use 
     39 * {@link #setProperty(String, String)} instead. 
    3640 *  
    3741 * @version $Id$ 
     
    6670        } 
    6771 
     72        /** 
     73         * Getter for a property of 'key'. 
     74         *  
     75         * @param key 
     76         *            the propery key 
     77         * @return the value in this property list with the specified key value. 
     78         * @see Properties#getProperty(String) 
     79         */ 
    6880        public static String getProperty(final String key) { 
    6981                return properties.getProperty(key); 
    7082        } 
     83 
     84        /** 
     85         * Setter for a property. If the property already exists, the value will be overwritten.<br> 
     86         * Hint: This method is intended for an alternative way to set user defaults programmatically 
     87         * instead of using the 'fckeditor.properties'. It should never used inside FCKeditor.Java !!! 
     88         *  
     89         * @param key 
     90         *            key the propery key 
     91         * @param value 
     92         * @throws IllegalArgumentException 
     93         *             if 'key' is empty. 
     94         * @see Properties#setProperty(String, String) 
     95         */ 
     96        public static void setProperty(final String key, final String value) { 
     97                if (Utils.isEmpty(key)) 
     98                        new IllegalArgumentException("The 'key' of a property schouldn't be null!"); 
     99                properties.setProperty(key, value); 
     100        } 
    71101} 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy