java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Properties.java
branchv_0
changeset 255 099bb96f8d8d
parent 250 aae5009bd0af
     1.1 --- a/java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Properties.java	Fri Sep 23 18:05:50 2022 +0200
     1.2 +++ b/java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Properties.java	Sun Feb 04 16:10:37 2024 +0100
     1.3 @@ -20,15 +20,16 @@
     1.4  import javax.xml.bind.annotation.XmlTransient;
     1.5  import static info.globalcode.sql.dk.Functions.findByName;
     1.6  import java.util.Collections;
     1.7 +import java.util.regex.Pattern;
     1.8  
     1.9  /**
    1.10   * <p>
    1.11   * List of configurables.</p>
    1.12   *
    1.13   * <p>
    1.14 - * Can be backed by defaults – if value for given name is nof found in this instance, we will
    1.15 - * look into defaults. Methods also accept defaultValue parameter – is used if property is nof found
    1.16 - * even in default properties.</p>
    1.17 + * Can be backed by defaults – if value for given name is nof found in this
    1.18 + * instance, we will look into defaults. Methods also accept defaultValue
    1.19 + * parameter – is used if property is nof found even in default properties.</p>
    1.20   *
    1.21   * <p>
    1.22   * Typical use: </p>
    1.23 @@ -94,6 +95,11 @@
    1.24  		return p == null ? defaultValue : Integer.valueOf(p.getValue());
    1.25  	}
    1.26  
    1.27 +	public Pattern getPattern(String name, Pattern defaultValue) {
    1.28 +		Property p = findProperty(name);
    1.29 +		return p == null ? defaultValue : Pattern.compile(p.getValue());
    1.30 +	}
    1.31 +
    1.32  	public boolean hasProperty(String name) {
    1.33  		return findByName(this, name) != null;
    1.34  	}