public class BitbucketUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.google.gson.Gson |
GSON_PARSER |
static com.google.gson.JsonParser |
JSON_PARSER |
Modifier | Constructor and Description |
---|---|
protected |
BitbucketUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> addEnvVars)
Add the passed environment variables to the currently existing env-vars.
|
static BitbucketAuthentication |
inferAuthentication()
Find credentials (Basic, Bearer, or Anonymous) from system/environment.
|
static java.lang.String |
inferEndpoint()
Find endpoint searching first within `System Properties` and
then within `Environment Variables` returning whichever has a
value first.
|
static java.util.Properties |
inferOverrides()
Find jclouds overrides (e.g.
|
static <T> java.util.List<T> |
nullToEmpty(java.lang.Iterable<? extends T> input)
Convert passed Iterable into an ImmutableList.
|
static <K,V> java.util.Map<K,V> |
nullToEmpty(java.util.Map<? extends K,? extends V> input)
Convert passed Map into an ImmutableMap.
|
static com.google.gson.JsonElement |
nullToJsonElement(com.google.gson.JsonElement input)
Convert passed Map into a JsonElement.
|
static com.google.gson.JsonElement |
nullToJsonElement(java.util.Map input)
Convert passed Map into a JsonElement.
|
static com.google.gson.JsonElement |
nullToJsonElement(java.lang.String input)
Convert passed String into a JsonElement.
|
static void |
removeEnvironmentVariables(java.util.Collection<java.lang.String> removeEnvVars)
Remove the passed environment variables keys from the environment.
|
static java.lang.String |
retriveExternalValue(java.lang.String systemProperty,
java.lang.String environmentVariable)
If the passed systemProperty is non-null we will attempt to query
the `System Properties` for a value and return it.
|
static void |
setEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> newEnvVars)
Re-set the environment variables with passed map.
|
public static final com.google.gson.Gson GSON_PARSER
public static final com.google.gson.JsonParser JSON_PARSER
public static <T> java.util.List<T> nullToEmpty(java.lang.Iterable<? extends T> input)
T
- an arbitrary type.input
- the Iterable to copy.public static <K,V> java.util.Map<K,V> nullToEmpty(java.util.Map<? extends K,? extends V> input)
K
- an arbitrary type.V
- an arbitrary type.input
- the Map to copy.public static com.google.gson.JsonElement nullToJsonElement(java.util.Map input)
input
- the Map to convert.public static com.google.gson.JsonElement nullToJsonElement(com.google.gson.JsonElement input)
input
- the Map to convert.public static com.google.gson.JsonElement nullToJsonElement(java.lang.String input)
input
- the String to convert.public static java.lang.String retriveExternalValue(@Nullable java.lang.String systemProperty, @Nullable java.lang.String environmentVariable)
systemProperty
- possibly existent System Property.environmentVariable
- possibly existent Environment Variable.public static java.lang.String inferEndpoint()
public static BitbucketAuthentication inferAuthentication()
public static java.util.Properties inferOverrides()
public static void addEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> addEnvVars)
addEnvVars
- the env-vars to add.public static void removeEnvironmentVariables(java.util.Collection<java.lang.String> removeEnvVars)
removeEnvVars
- the env-var keys to be removed.public static void setEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> newEnvVars)
newEnvVars
- map to reset env-vars with.