public class Systems extends Object
Constructor and Description |
---|
Systems() |
Modifier and Type | Method and Description |
---|---|
static String |
getEnvVar(String envVarName,
String defaultValue)
Returns the value of the given environment variable if its not blank or the given default value
|
static String |
getEnvVarOrSystemProperty(String envVarName) |
static Boolean |
getEnvVarOrSystemProperty(String name,
Boolean defaultValue) |
static Number |
getEnvVarOrSystemProperty(String name,
Number defaultValue) |
static String |
getEnvVarOrSystemProperty(String envVarName,
String defaultValue) |
static String |
getEnvVarOrSystemProperty(String envVarName,
String systemProperty,
String defaultValue)
Returns the value of the given environment variable or system property and if both are blank return the default value
|
protected static String |
getServiceEnvVarPrefix(String serviceName) |
static String |
getServiceHostAndPort(String serviceName,
String defaultHost,
String defaultPort)
Returns the service host and port for the given environment variable name.
|
static String |
getServiceHostAndPort(String serviceNameEnvVar,
String defaultServiceName,
String defaultHost,
String defaultPort)
Returns the service host and port for the given environment variable name.
|
static String |
getSystemPropertyOrEnvVar(String systemProperty,
String envVarName,
String defaultValue) |
static boolean |
hasEnvVarOrSystemProperty(String envVarName) |
public static String getSystemPropertyOrEnvVar(String systemProperty, String envVarName, String defaultValue)
public static String getEnvVarOrSystemProperty(String envVarName, String systemProperty, String defaultValue)
public static boolean hasEnvVarOrSystemProperty(String envVarName)
public static String getEnvVarOrSystemProperty(String envVarName, String defaultValue)
public static Number getEnvVarOrSystemProperty(String name, Number defaultValue)
public static Boolean getEnvVarOrSystemProperty(String name, Boolean defaultValue)
public static String getEnvVar(String envVarName, String defaultValue)
public static String getServiceHostAndPort(String serviceNameEnvVar, String defaultServiceName, String defaultHost, String defaultPort)
serviceNameEnvVar
- the name of the environment variable used to configure the name of the service to connect todefaultServiceName
- the default name of the service to use if the environment variable is not setdefaultHost
- the default host to use if not injected via an environment variable (e.g. localhost)public static String getServiceHostAndPort(String serviceName, String defaultHost, String defaultPort)
serviceName
- the name of the service which is used as a prefix to access the ${serviceName}_SERVICE_HOST
and ${serviceName}_SERVICE_PORT
environment variables to find the hos and portdefaultHost
- the default host to use if not injected via an environment variable (e.g. localhost)Copyright © 2011–2016 Red Hat. All rights reserved.