java/sql-dk/src/info/globalcode/sql/dk/configuration/Properties.java
branchv_0
changeset 191 862d0a8747ac
parent 155 eb3676c6929b
equal deleted inserted replaced
190:3d4d378adc10 191:862d0a8747ac
    21 import javax.xml.bind.annotation.XmlTransient;
    21 import javax.xml.bind.annotation.XmlTransient;
    22 import static info.globalcode.sql.dk.Functions.findByName;
    22 import static info.globalcode.sql.dk.Functions.findByName;
    23 import java.util.Collections;
    23 import java.util.Collections;
    24 
    24 
    25 /**
    25 /**
    26  * <p>List of configurables.</p>
    26  * <p>
       
    27  * List of configurables.</p>
    27  *
    28  *
    28  * <p>Can be backed by defaults – if value for given name is nof found in this instance, we will
    29  * <p>
       
    30  * Can be backed by defaults – if value for given name is nof found in this instance, we will
    29  * look into defaults. Methods also accept defaultValue parameter – is used if property is nof found
    31  * look into defaults. Methods also accept defaultValue parameter – is used if property is nof found
    30  * even in default properties.</p>
    32  * even in default properties.</p>
    31  *
    33  *
    32  * <p>Typical use: </p>
    34  * <p>
       
    35  * Typical use: </p>
    33  * <ul>
    36  * <ul>
    34  * <li>this instance – ad-hoc properties from CLI options</li>
    37  * <li>this instance – ad-hoc properties from CLI options</li>
    35  * <li>default properties – from config file</li>
    38  * <li>default properties – from config file</li>
    36  * <li>defaultValue – hardcoded default</li>
    39  * <li>defaultValue – hardcoded default</li>
    37  * </ul>
    40  * </ul>
   115 	private void duplicateTo(java.util.Properties javaProperties) {
   118 	private void duplicateTo(java.util.Properties javaProperties) {
   116 		if (defaults != null) {
   119 		if (defaults != null) {
   117 			defaults.duplicateTo(javaProperties);
   120 			defaults.duplicateTo(javaProperties);
   118 		}
   121 		}
   119 		for (Property p : this) {
   122 		for (Property p : this) {
   120 			javaProperties.setProperty(p.getName(), p.getValue());
   123 			String value = p.getValue();
       
   124 			if (value != null) {
       
   125 				javaProperties.setProperty(p.getName(), value);
       
   126 			}
   121 		}
   127 		}
   122 	}
   128 	}
   123 }
   129 }