JBoss Modular Service Kernel API 1.0.0.CR2

org.jboss.msc.value
Class SystemPropertyValue

java.lang.Object
  extended by org.jboss.msc.value.SystemPropertyValue
All Implemented Interfaces:
PrivilegedAction<String>, Value<String>

public final class SystemPropertyValue
extends Object
implements Value<String>, PrivilegedAction<String>

A value which comes from a system property.

Author:
David M. Lloyd
See Also:
System.getProperty(String)

Constructor Summary
SystemPropertyValue(String propertyName)
          Construct a new instance.
SystemPropertyValue(String propertyName, AccessControlContext accessControlContext)
          Construct a new instance.
SystemPropertyValue(String propertyName, AccessControlContext accessControlContext, Value<?> defaultValue)
          Construct a new instance.
SystemPropertyValue(String propertyName, Value<?> defaultValue)
          Construct a new instance.
 
Method Summary
 String getValue()
          Get the actual value.
 String run()
          Fetch the property in an unprivileged context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemPropertyValue

public SystemPropertyValue(String propertyName)
Construct a new instance.

Parameters:
propertyName - the property name to read

SystemPropertyValue

public SystemPropertyValue(String propertyName,
                           AccessControlContext accessControlContext)
Construct a new instance.

Parameters:
propertyName - the property name to read
accessControlContext - the access control context in which to fetch the property value

SystemPropertyValue

public SystemPropertyValue(String propertyName,
                           Value<?> defaultValue)
Construct a new instance.

Parameters:
propertyName - the property name to read
defaultValue - the value to use if the property is unset

SystemPropertyValue

public SystemPropertyValue(String propertyName,
                           AccessControlContext accessControlContext,
                           Value<?> defaultValue)
Construct a new instance.

Parameters:
propertyName - the property name to read
accessControlContext - the access control context in which to fetch the property value
defaultValue - the value to use if the property is unset
Method Detail

getValue

public String getValue()
                throws IllegalStateException,
                       IllegalArgumentException
Get the actual value.

Specified by:
getValue in interface Value<String>
Returns:
the actual value
Throws:
IllegalStateException - if the value is time-sensitive and the current state does not allow retrieval.
IllegalArgumentException - when the value cannot be read due to misconfiguration

run

public String run()
Fetch the property in an unprivileged context.

Specified by:
run in interface PrivilegedAction<String>
Returns:
the property value

JBoss Modular Service Kernel API 1.0.0.CR2

Copyright © 2011 JBoss, a division of Red Hat, Inc.