com.softicar.platform.common.core.properties.Property Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.properties;
import java.util.Objects;
import java.util.function.Function;
/**
* Default implementation of {@link IProperty}.
*
* @author Oliver Richers
*/
public class Property extends AbstractProperty {
private final IPropertyMap propertyMap;
/**
* Constructs this property using the given property name.
*
* @param propertyMap
* the name holding the value of the property (never null)
* @param propertyName
* the name used to read the value from the configuration file
* @param defaultValue
* the default value to return by {@link #getValue()} if no value
* is defined
* @param parser
* the parser to parse the textual value
*/
protected Property(IPropertyMap propertyMap, PropertyName propertyName, T defaultValue, Function parser) {
super(propertyName, defaultValue, parser);
this.propertyMap = Objects.requireNonNull(propertyMap);
}
@Override
protected String getValueString(PropertyName propertyName) {
return propertyMap.getValueString(propertyName);
}
}