@Internal public abstract class AbstractSystemProperty extends Object
SystemProperty
while at the same time being used as type of its static fields.Modifier and Type | Field and Description |
---|---|
protected String |
myPropertyKey |
protected String |
myPropertyValue |
Modifier | Constructor and Description |
---|---|
protected |
AbstractSystemProperty(boolean mandatory,
String... properties)
Creates an instance containing the value of the given property - logs an error if it cannot be found
|
protected |
AbstractSystemProperty(String property,
boolean mandatory,
org.apache.log4j.Logger log)
Used in testing
|
Modifier and Type | Method and Description |
---|---|
boolean |
exists() |
protected static String |
getEnvironmentVariable(String variable,
boolean mandatory)
Obtain the specified environment variable.
|
String |
getKey()
Obtain the key used to find this property
|
String |
getValue()
Obtain the value of this proprty
|
boolean |
getValue(boolean defaultValue)
Obtain the boolean property value
|
int |
getValue(int defaultValue) |
long |
getValue(long defaultValue) |
String |
getValue(String defaultValue)
Obtain the value of the property (returns the default value if the environment variable has not been defined.
|
void |
setValue(String propertyValue)
So the setting can be set by a test
|
String |
toString() |
protected String myPropertyValue
protected String myPropertyKey
protected AbstractSystemProperty(boolean mandatory, String... properties)
mandatory
- Is the property mandatory or optional?properties
- The property we're loading from the environment (first name found will be loaded)protected AbstractSystemProperty(String property, boolean mandatory, org.apache.log4j.Logger log)
property
- The property we're loading from the environmentmandatory
- Is the property mandatory or optional?log
- The logger we're logging errors topublic int getValue(int defaultValue)
public long getValue(long defaultValue)
@Nullable public String getValue()
public String getKey()
@NotNull public String getValue(@NotNull String defaultValue)
defaultValue
- The default value, if the environment variable has not been definedpublic boolean getValue(boolean defaultValue)
defaultValue
- The default value, if the environment variable has not been definedpublic void setValue(String propertyValue)
propertyValue
- The value required by the testpublic boolean exists()
@Nullable protected static String getEnvironmentVariable(@NotNull String variable, boolean mandatory)
variable
- The variable we requiremandatory
- Is this a mandatory property?Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.