Package com.vaadin.flow.server
Class AbstractPropertyConfiguration
- java.lang.Object
-
- com.vaadin.flow.server.AbstractPropertyConfiguration
-
- All Implemented Interfaces:
AbstractConfiguration,Serializable
- Direct Known Subclasses:
AbstractDeploymentConfiguration,DefaultApplicationConfigurationFactory.ApplicationConfigurationImpl
public abstract class AbstractPropertyConfiguration extends Object implements AbstractConfiguration
Provides a configuration based on string properties.- Since:
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPropertyConfiguration(Map<String,String> properties)Creates a new instance with givenproperties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetApplicationOrSystemProperty(String propertyName, T defaultValue, Function<String,T> converter)Gets a configured property.StringgetApplicationProperty(String parameterName)Gets an application property value.protected StringgetApplicationProperty(Function<String,String> valueProvider, String propertyName)Gets application property value using thevalueProvider.booleangetBooleanProperty(String name, boolean defaultValue)Gets a configured property as a boolean.protected Map<String,String>getProperties()Gets unmodifiable underlying properties.StringgetStringProperty(String name, String defaultValue)Gets a configured property as a string.protected StringgetSystemProperty(String parameterName)Gets an system property value.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.server.AbstractConfiguration
enableDevServer, getBuildFolder, getJavaResourceFolder, isGlobalPnpm, isPnpmEnabled, isProductionMode, isUsageStatisticsEnabled, isXsrfProtectionEnabled, reuseDevServer, useV14Bootstrap
-
-
-
-
Method Detail
-
getStringProperty
public String getStringProperty(String name, String defaultValue)
Description copied from interface:AbstractConfigurationGets a configured property as a string.- Specified by:
getStringPropertyin interfaceAbstractConfiguration- Parameters:
name- The simple of the property, in some contexts, lookup might be performed using variations of the provided name.defaultValue- the default value that should be used if no value has been defined- Returns:
- the property value, or the passed default value if no property value is found
-
getBooleanProperty
public boolean getBooleanProperty(String name, boolean defaultValue)
Description copied from interface:AbstractConfigurationGets a configured property as a boolean.- Specified by:
getBooleanPropertyin interfaceAbstractConfiguration- Parameters:
name- The simple of the property, in some contexts, lookup might be performed using variations of the provided name.defaultValue- the default value that should be used if no value has been defined- Returns:
- the property value, or the passed default value if no property value is found
-
getApplicationProperty
public String getApplicationProperty(String parameterName)
Gets an application property value.- Parameters:
parameterName- the Name or the parameter.- Returns:
- String value or null if not found
-
getProperties
protected Map<String,String> getProperties()
Gets unmodifiable underlying properties.- Returns:
- the properties map
-
getApplicationOrSystemProperty
public <T> T getApplicationOrSystemProperty(String propertyName, T defaultValue, Function<String,T> converter)
Gets a configured property. The properties are typically read from e.g. web.xml or from system properties of the JVM.- Type Parameters:
T- type of a property- Parameters:
propertyName- The simple of the property, in some contexts, lookup might be performed using variations of the provided name.defaultValue- the default value that should be used if no value has been definedconverter- the way string should be converted into the required property- Returns:
- the property value, or the passed default value if no property value is found
-
getSystemProperty
protected String getSystemProperty(String parameterName)
Gets an system property value.- Parameters:
parameterName- the Name or the parameter.- Returns:
- String value or null if not found
-
getApplicationProperty
protected String getApplicationProperty(Function<String,String> valueProvider, String propertyName)
Gets application property value using thevalueProvider.- Parameters:
valueProvider- a value provider for the propertypropertyName- the name or the parameter.- Returns:
- String value or null if not found
-
-