@PublicApi public interface

ApplicationProperties

com.atlassian.jira.config.properties.ApplicationProperties
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

This can be used to lookup JIRA application properties. This uses a two stage strategy for finding property values. First the database is checked to see if a value exists. If it doesnt exist, it falls back to the file for a value. Once a key is placed in the database (via an upgrade task or UI interaction) then it will always be loaded from the database. NOTE : Be very careful with boolean property values. Because of the way OSPropertySets work, its impossible to distinguish between properties that have a false value and properties that have NO value. Therefore it is usually better to have a "String" property set to the value "true" or "false" and then use Boolean.valueOf() in it. This way it's possible to distinguish the absence of a property value from it being set to false.

Summary

Public Methods
@Internal Map<StringObject> asMap()
This will return all application and typed values.
String getContentType()
String getDefaultBackedString(String name)
Get the property from the application properties, but if not found, try to get from the default properties file.
String getDefaultBackedText(String name)
Get the property from the application properties, but if not found, try to get from the default properties file.
Collection<String> getDefaultKeys()
Get all the keys from the default properties
Locale getDefaultLocale()
String getDefaultString(String name)
Get the default property (if the property is not set)
String getEncoding()
Convenience method to get the content type for an application
Collection<String> getKeys()
String getMailEncoding()
Convenience method to get the email encoding
boolean getOption(String key)
Get the option from the application properties, but if not found, try to get from the default properties file.
String getString(String name)
Collection<String> getStringsWithPrefix(String prefix)
String getText(String name)
void refresh()
Refresh application properties object by refreshing the PropertiesManager
void setOption(String key, boolean value)
void setString(String name, String value)
void setText(String name, String value)

Public Methods

@Internal public Map<StringObject> asMap ()

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

This will return all application and typed values. For example if the property is a boolean then a Boolean object will be returned. If an application property has a null value, then the key will still be in the keySet()

WARNING: This method is somewhat expensive. Do not use it unless you really are doing something with all of the application properties, such as for the system information page. If you are just retrieving a single property, then use one of the get methods instead. For most properties, getDefaultBackedString(String) or getOption(String) will be the best choice.

Returns
  • a map of key to actual value object

public String getContentType ()

public String getDefaultBackedString (String name)

Get the property from the application properties, but if not found, try to get from the default properties file.

public String getDefaultBackedText (String name)

Get the property from the application properties, but if not found, try to get from the default properties file.

public Collection<String> getDefaultKeys ()

Get all the keys from the default properties

public Locale getDefaultLocale ()

public String getDefaultString (String name)

Get the default property (if the property is not set)

Parameters
name the name of the property.

public String getEncoding ()

Convenience method to get the content type for an application

public Collection<String> getKeys ()

public String getMailEncoding ()

Convenience method to get the email encoding

public boolean getOption (String key)

Get the option from the application properties, but if not found, try to get from the default properties file.

public String getString (String name)

public Collection<String> getStringsWithPrefix (String prefix)

public String getText (String name)

public void refresh ()

Refresh application properties object by refreshing the PropertiesManager

public void setOption (String key, boolean value)

public void setString (String name, String value)

public void setText (String name, String value)