Package com.axelor.app
Class AppSettings
- java.lang.Object
-
- com.axelor.app.AppSettings
-
public final class AppSettings extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableFeature(String name)
Disable specified featurevoid
enableFeature(String name)
Enable specified featureString
format(String value)
Format the property value.static AppSettings
get()
String
get(String key)
String
get(String key, String defaultValue)
String
getBaseURL()
Get the application base URL.boolean
getBoolean(String key, boolean defaultValue)
int
getInt(String key, int defaultValue)
Map<String,String>
getInternalProperties()
For internal use only.List<String>
getList(String key)
<T> List<T>
getList(String key, Function<String,T> mapper)
String
getPath(String key, String defaultValue)
Map<String,String>
getProperties()
For internal use only.Set<String>
getPropertiesKeys()
Get all properties keysSet<String>
getPropertiesKeysStartingWith(String prefix)
Get properties keys starting with the given prefixMap<String,String>
getPropertiesStartingWith(String prefix)
Get properties where the key start with the given prefixboolean
hasFeature(String name)
Check whether specified feature is enabledboolean
isProduction()
-
-
-
Method Detail
-
get
public static AppSettings get()
-
getInt
public int getInt(String key, int defaultValue)
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
-
format
public String format(String value)
Format the property value. Variables in the format${}
format will be substituted.- Parameters:
value
- the property value- Returns:
- the formatted property value
-
getBaseURL
public String getBaseURL()
Get the application base URL.This method tries to calculate the base url from current http request. If the method is called outside of http request scope, it returns the value of
application.base-url
configuration setting.- Returns:
- application base url
-
isProduction
public boolean isProduction()
-
getInternalProperties
public Map<String,String> getInternalProperties()
For internal use only.- Returns:
- the internal properties store
-
getProperties
public Map<String,String> getProperties()
For internal use only.- Returns:
- the internal properties store
-
getPropertiesKeys
public Set<String> getPropertiesKeys()
Get all properties keys- Returns:
- an unmodifiable
Set
of keys
-
getPropertiesKeysStartingWith
public Set<String> getPropertiesKeysStartingWith(String prefix)
Get properties keys starting with the given prefix- Returns:
- an unmodifiable
Set
of keys
-
getPropertiesStartingWith
public Map<String,String> getPropertiesStartingWith(String prefix)
Get properties where the key start with the given prefix- Returns:
- an unmodifiable
Map
of matching properties
-
enableFeature
public void enableFeature(String name)
Enable specified feature- Parameters:
name
- name of the feature
-
disableFeature
public void disableFeature(String name)
Disable specified feature- Parameters:
name
- name of the feature
-
hasFeature
public boolean hasFeature(String name)
Check whether specified feature is enabled- Parameters:
name
- name of the feature- Returns:
- true if feature is enabled false otherwise
-
-