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

com.softicar.platform.common.core.properties.Property 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.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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy