All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.properties.SystemPropertyFactory Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy