com.softicar.platform.common.core.properties.SystemPropertyFactory 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.math.BigDecimal;
import java.util.function.Function;
/**
* A factory for {@link SystemProperty} based instances of {@link IProperty}.
*
* @author Alexander Schmidt
*/
public class SystemPropertyFactory extends AbstractPropertyFactory {
public SystemPropertyFactory() {
this("");
}
public SystemPropertyFactory(String namePrefix) {
super(namePrefix);
}
public IProperty createIntegerProperty(String name, Integer defaultValue) {
return new SystemProperty<>(createName(name), defaultValue, Integer::parseInt);
}
public IProperty createStringProperty(String name, String defaultValue) {
return new SystemProperty<>(createName(name), defaultValue, Function.identity());
}
public IProperty createBooleanProperty(String name, Boolean defaultValue) {
return new SystemProperty<>(createName(name), defaultValue, Boolean::parseBoolean);
}
public IProperty createBigDecimalProperty(String name, BigDecimal defaultValue) {
return new SystemProperty<>(createName(name), defaultValue, BigDecimal::new);
}
}