public final class SystemPropertyUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SystemPropertyUtil.Platform
Inspired from http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/
SystemUtils.html
|
Modifier and Type | Field and Description |
---|---|
static String |
FILE_ENCODING |
static String |
WAARP_DATABASE_CONNECTION_MAX
Maximum Connections to the Database.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear(String key)
Remove the key of the Java system property with the specified
key . |
static boolean |
contains(String key)
Returns
true if and only if the system property with the
specified
key exists. |
static void |
debug() |
static void |
debug(PrintStream out)
Print to System.out the content of the properties
|
static String |
get(String key)
Returns the value of the Java system property with the specified
key , while falling back to
null if the property access fails. |
static boolean |
get(String key,
boolean def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static int |
get(String key,
int def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static long |
get(String key,
long def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static String |
get(String key,
String def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static boolean |
getAndSet(String key,
boolean def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static int |
getAndSet(String key,
int def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static long |
getAndSet(String key,
long def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static String |
getAndSet(String key,
String def)
Returns the value of the Java system property with the specified
key , while falling back to the specified
default value if the property access fails. |
static boolean |
getBoolean(String key,
boolean def)
Returns the value of the Java system property with the specified
key , while falling back to the
specified default value if the property access fails. |
static int |
getInt(String key,
int def)
Returns the value of the Java system property with the specified
key , while falling back to the
specified default value if the property access fails. |
static long |
getLong(String key,
long def)
Returns the value of the Java system property with the specified
key , while falling back to the
specified default value if the property access fails. |
static SystemPropertyUtil.Platform |
getOS() |
static boolean |
isFileEncodingCorrect() |
static boolean |
isMac() |
static boolean |
isSolaris() |
static boolean |
isUnix() |
static boolean |
isWindows() |
static void |
refresh()
Re-retrieves all system properties so that any post-launch properties
updates are retrieved.
|
static boolean |
set(String key,
boolean def)
Set the value of the Java system property with the specified
key
to the specified default value. |
static int |
set(String key,
int def)
Set the value of the Java system property with the specified
key
to the specified default value. |
static long |
set(String key,
long def)
Set the value of the Java system property with the specified
key
to the specified default value. |
static String |
set(String key,
String def)
Set the value of the Java system property with the specified
key
to the specified default value. |
public static final String FILE_ENCODING
public static final String WAARP_DATABASE_CONNECTION_MAX
public static void refresh()
public static boolean isFileEncodingCorrect()
public static boolean contains(String key)
true
if and only if the system property with the
specified
key
exists.public static String get(String key)
key
, while falling back to
null
if the property access fails.null
public static String get(String key, String def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static boolean get(String key, boolean def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static int get(String key, int def)
key
, while falling back to the specified
default value if the property access fails.key
- the system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static long get(String key, long def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static boolean getBoolean(String key, boolean def)
key
, while falling back to the
specified default value if the property access fails.def
if there's no such property or if
an access to the specified
property is not allowed.public static int getInt(String key, int def)
key
, while falling back to the
specified default value if the property access fails.def
if there's no such property or if
an access to the specified
property is not allowed.public static long getLong(String key, long def)
key
, while falling back to the
specified default value if the property access fails.def
if there's no such property or if
an access to the specified
property is not allowed.public static String getAndSet(String key, String def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key or def nullpublic static boolean getAndSet(String key, boolean def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static int getAndSet(String key, int def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static long getAndSet(String key, long def)
key
, while falling back to the specified
default value if the property access fails.key
- of system propertydef
- the default valuedef
if there's no such property or if
an access to the specified property is
not allowed.IllegalArgumentException
- key nullpublic static String set(String key, String def)
key
to the specified default value.key
- of system propertydef
- the default valueIllegalArgumentException
- key or def nullpublic static boolean set(String key, boolean def)
key
to the specified default value.key
- of system propertydef
- the default valueIllegalArgumentException
- key nullpublic static int set(String key, int def)
key
to the specified default value.key
- of system propertydef
- the default valueIllegalArgumentException
- key nullpublic static long set(String key, long def)
key
to the specified default value.key
- of system propertydef
- the default valueIllegalArgumentException
- key nullpublic static void clear(String key)
key
.key
- of system propertyIllegalArgumentException
- key nullpublic static void debug(PrintStream out)
out
- the output stream to be usedIllegalArgumentException
- out nullpublic static SystemPropertyUtil.Platform getOS()
public static boolean isWindows()
public static boolean isMac()
public static boolean isUnix()
public static boolean isSolaris()
public static void debug()
Copyright © 2009–2020 Waarp. All rights reserved.