Package org.jboss.msc.value
Class SystemPropertyValue
- java.lang.Object
-
- org.jboss.msc.value.SystemPropertyValue
-
- All Implemented Interfaces:
java.security.PrivilegedAction<java.lang.String>
,Value<java.lang.String>
public final class SystemPropertyValue extends java.lang.Object implements Value<java.lang.String>, java.security.PrivilegedAction<java.lang.String>
A value which comes from a system property.- See Also:
System.getProperty(String)
-
-
Field Summary
Fields Modifier and Type Field Description private java.security.AccessControlContext
accessControlContext
private Value<?>
defaultValue
private java.lang.String
propertyName
-
Constructor Summary
Constructors Constructor Description SystemPropertyValue(java.lang.String propertyName)
Construct a new instance.SystemPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext)
Construct a new instance.SystemPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext, Value<?> defaultValue)
Construct a new instance.SystemPropertyValue(java.lang.String propertyName, Value<?> defaultValue)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getValue()
Get the actual value.java.lang.String
run()
Fetch the property in an unprivileged context.
-
-
-
Field Detail
-
propertyName
private final java.lang.String propertyName
-
accessControlContext
private final java.security.AccessControlContext accessControlContext
-
defaultValue
private final Value<?> defaultValue
-
-
Constructor Detail
-
SystemPropertyValue
public SystemPropertyValue(java.lang.String propertyName)
Construct a new instance.- Parameters:
propertyName
- the property name to read
-
SystemPropertyValue
public SystemPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext)
Construct a new instance.- Parameters:
propertyName
- the property name to readaccessControlContext
- the access control context in which to fetch the property value
-
SystemPropertyValue
public SystemPropertyValue(java.lang.String propertyName, Value<?> defaultValue)
Construct a new instance.- Parameters:
propertyName
- the property name to readdefaultValue
- the value to use if the property is unset
-
SystemPropertyValue
public SystemPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext, Value<?> defaultValue)
Construct a new instance.- Parameters:
propertyName
- the property name to readaccessControlContext
- the access control context in which to fetch the property valuedefaultValue
- the value to use if the property is unset
-
-
Method Detail
-
getValue
public java.lang.String getValue() throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Get the actual value.
-
run
public java.lang.String run()
Fetch the property in an unprivileged context.- Specified by:
run
in interfacejava.security.PrivilegedAction<java.lang.String>
- Returns:
- the property value
-
-