SystemPropertyUtil Class — netty Architecture
Architecture documentation for the SystemPropertyUtil class in SystemPropertyUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90["SystemPropertyUtil"] 306e8779_7995_cbbb_848f_d17997e18303["SystemPropertyUtil.java"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|defined in| 306e8779_7995_cbbb_848f_d17997e18303 0470eacb_fb73_1ced_1214_cb011d5bf4d4["contains()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| 0470eacb_fb73_1ced_1214_cb011d5bf4d4 3b80f13e_bf5d_36ba_9636_b3919d5ea0da["String()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| 3b80f13e_bf5d_36ba_9636_b3919d5ea0da 645d1cc7_0726_457e_4ea4_807f04a030b2["getBoolean()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| 645d1cc7_0726_457e_4ea4_807f04a030b2 a94b1a19_d177_8d47_52d7_bfc770a0fa9c["getInt()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| a94b1a19_d177_8d47_52d7_bfc770a0fa9c 9ff766c3_c79f_4281_131a_f307dc23fb65["getLong()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| 9ff766c3_c79f_4281_131a_f307dc23fb65 bb6f575f_5239_f9c0_ead2_2951c1557ee6["SystemPropertyUtil()"] 1e2b5a90_1617_877a_4b1d_2ffa3b96bb90 -->|method| bb6f575f_5239_f9c0_ead2_2951c1557ee6
Relationship Graph
Source Code
common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java lines 29–185
public final class SystemPropertyUtil {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SystemPropertyUtil.class);
/**
* Returns {@code true} if and only if the system property with the specified {@code key}
* exists.
*/
public static boolean contains(String key) {
return get(key) != null;
}
/**
* Returns the value of the Java system property with the specified
* {@code key}, while falling back to {@code null} if the property access fails.
*
* @return the property value or {@code null}
*/
public static String get(String key) {
return get(key, null);
}
/**
* Returns the value of the Java system property with the specified
* {@code key}, while falling back to the specified default value if
* the property access fails.
*
* @return the property value.
* {@code def} if there's no such property or if an access to the
* specified property is not allowed.
*/
public static String get(final String key, String def) {
checkNonEmpty(key, "key");
String value = null;
try {
if (System.getSecurityManager() == null) {
value = System.getProperty(key);
} else {
value = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty(key);
}
});
}
} catch (SecurityException e) {
logger.warn("Unable to retrieve a system property '{}'; default values will be used.", key, e);
}
if (value == null) {
return def;
}
return value;
}
/**
* Returns the value of the Java system property with the specified
* {@code key}, while falling back to the specified default value if
* the property access fails.
*
* @return the property value.
* {@code def} if there's no such property or if an access to the
* specified property is not allowed.
*/
public static boolean getBoolean(String key, boolean def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim().toLowerCase();
if (value.isEmpty()) {
return def;
}
if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
return true;
}
Source
Frequently Asked Questions
What is the SystemPropertyUtil class?
SystemPropertyUtil is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java.
Where is SystemPropertyUtil defined?
SystemPropertyUtil is defined in common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free