Class SystemPropertyUtil
java.lang.Object
io.clonecloudstore.common.standard.system.SystemPropertyUtil
- Direct Known Subclasses:
QuarkusSystemPropertyUtil
A collection of utility methods to retrieve and parse the values of the Java
system properties and from ConfigProvider.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Inspired from http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/ SystemUtils.html -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Remove the key of the Java system property with the specifiedkey
.static boolean
Returnstrue
if and only if the system property with the specifiedkey
exists.static void
debug()
static void
debug
(PrintStream out) Print to System.out the content of the propertiesstatic String
Returns the value of the Java system property with the specifiedkey
, while falling back tonull
if the property access fails.static boolean
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static int
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static long
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static String
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static boolean
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static int
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static long
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static String
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.static SystemPropertyUtil.Platform
getOS()
static boolean
isMac()
static boolean
static boolean
isUnix()
static boolean
static void
refresh()
Re-retrieves all system properties so that any post-launch properties updates are retrieved.static boolean
Set the value of the Java system property with the specifiedkey
to the specified default value.static int
Set the value of the Java system property with the specifiedkey
to the specified default value.static long
Set the value of the Java system property with the specifiedkey
to the specified default value.static String
Set the value of the Java system property with the specifiedkey
to the specified default value.
-
Constructor Details
-
SystemPropertyUtil
protected SystemPropertyUtil()
-
-
Method Details
-
getAndSet
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key or def null
-
refresh
public static void refresh()Re-retrieves all system properties so that any post-launch properties updates are retrieved. -
contains
Returnstrue
if and only if the system property with the specifiedkey
exists. -
get
Returns the value of the Java system property with the specifiedkey
, while falling back tonull
if the property access fails.- Returns:
- the property value or
null
-
get
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
get
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
get
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- the system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
get
Returns the value of the Java system property with the specifiedkey
, while falling back to the specified default value if the property access fails.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the property value.
def
if there's no such property or if an access to the specified property is not allowed. - Throws:
CcsInvalidArgumentRuntimeException
- key null
-
set
Set the value of the Java system property with the specifiedkey
to the specified default value.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the ancient value.
- Throws:
CcsInvalidArgumentRuntimeException
- key or def null
-
set
Set the value of the Java system property with the specifiedkey
to the specified default value.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the ancient value.
- Throws:
CcsInvalidArgumentRuntimeException
- key null
-
set
Set the value of the Java system property with the specifiedkey
to the specified default value.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the ancient value.
- Throws:
CcsInvalidArgumentRuntimeException
- key null
-
set
Set the value of the Java system property with the specifiedkey
to the specified default value.- Parameters:
key
- of system propertydef
- the default value- Returns:
- the ancient value.
- Throws:
CcsInvalidArgumentRuntimeException
- key null
-
clear
Remove the key of the Java system property with the specifiedkey
.- Parameters:
key
- of system property- Throws:
CcsInvalidArgumentRuntimeException
- key null
-
debug
Print to System.out the content of the properties- Parameters:
out
- the output stream to be used- Throws:
CcsInvalidArgumentRuntimeException
- out null
-
isWindows
public static boolean isWindows()- Returns:
- True if Windows
-
getOS
- Returns:
- the Platform
-
isMac
public static boolean isMac()- Returns:
- True if Mac
-
isUnix
public static boolean isUnix()- Returns:
- True if Unix
-
isSolaris
public static boolean isSolaris()- Returns:
- True if Solaris
-
debug
public static void debug()
-