Search in sources :

Example 6 with Property

use of org.whole.lang.properties.model.Property in project whole by wholeplatform.

the class PropertiesUtils method getProperty.

public static String getProperty(Properties props, String name, String defaultValue) {
    if (EntityUtils.isResolver(props))
        return defaultValue;
    PropertiesEntityFactory lf = PropertiesEntityFactory.instance;
    Property pattern = lf.createProperty(lf.createPropertyName(name), createVariable(PropertiesEntityDescriptorEnum.PropertyValue, "value"));
    Property property = Matcher.findChild(pattern, props.getEntries());
    if (property == null)
        return getProperty(props.getDefaults(), name, defaultValue);
    else
        return property.getValue().wStringValue();
}
Also used : PropertiesEntityFactory(org.whole.lang.properties.factories.PropertiesEntityFactory) Property(org.whole.lang.properties.model.Property)

Aggregations

Property (org.whole.lang.properties.model.Property)6 PropertiesEntityFactory (org.whole.lang.properties.factories.PropertiesEntityFactory)3 ArrayList (java.util.ArrayList)2 IEntity (org.whole.lang.model.IEntity)2 Properties (org.whole.lang.properties.model.Properties)2 PropertyValue (org.whole.lang.properties.model.PropertyValue)2 Test (org.junit.Test)1