diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/Configuration.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/Configuration.java index 6c0d8acf68ef3..0189118a73076 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/Configuration.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/Configuration.java @@ -130,6 +130,7 @@ public class Configuration implements Cloneable { PROPERTY_AZURE_CLIENT_ID, PROPERTY_AZURE_CLIENT_SECRET, PROPERTY_AZURE_TENANT_ID, + PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH, PROPERTY_AZURE_RESOURCE_GROUP, PROPERTY_AZURE_CLOUD, PROPERTY_AZURE_AUTHORITY_HOST, @@ -174,9 +175,12 @@ public static Configuration getGlobalConfiguration() { /** * Gets the value of the configuration. + *

+ * This method first checks the values previously loaded from the environment, if the configuration is found there + * it will be returned. Otherwise, this will attempt to load the value from the environment. * * @param name Name of the configuration. - * @return Value of the configuration if found, otherwise {@code null}. + * @return Value of the configuration if found, otherwise null. */ public String get(String name) { return getOrLoad(name); @@ -184,7 +188,10 @@ public String get(String name) { /** * Gets the value of the configuration converted to {@code T}. - * + *

+ * This method first checks the values previously loaded from the environment, if the configuration is found there + * it will be returned. Otherwise, this will attempt to load the value from the environment. + *

* If no configuration is found, the {@code defaultValue} is returned. * * @param name Name of the configuration. @@ -197,11 +204,16 @@ public T get(String name, T defaultValue) { } /** - * Gets the converted value of the configuration. + * Gets the value of the configuration and converts it with the {@code converter}. + *

+ * This method first checks the values previously loaded from the environment, if the configuration is found there + * it will be returned. Otherwise, this will attempt to load the value from the environment. + *

+ * If no configuration is found the {@code converter} won't be called and null will be returned. * * @param name Name of the configuration. * @param converter Converter used to map the configuration to {@code T}. - * @param Generic type that the configuration is converted to if found. + * @param Type that the configuration is converted to if found. * @return The converted configuration if found, otherwise null. */ public T get(String name, Function converter) { @@ -266,8 +278,8 @@ String loadFromProperties(String name) { /** * Adds a configuration with the given value. - * - * If a configuration with the same name already exists, this will update it to the passed value. + *

+ * This will overwrite the previous configuration value if it existed. * * @param name Name of the configuration. * @param value Value of the configuration. @@ -280,9 +292,11 @@ public Configuration put(String name, String value) { /** * Removes the configuration. + *

+ * This returns the value of the configuration if it previously existed. * * @param name Name of the configuration. - * @return If the configuration was removed the value of it, otherwise {@code null}. + * @return The configuration if it previously existed, otherwise null. */ public String remove(String name) { return configurations.remove(name); @@ -290,6 +304,9 @@ public String remove(String name) { /** * Determines if the configuration exists. + *

+ * This only checks against values previously loaded into the Configuration object, this won't inspect the + * environment for containing the value. * * @param name Name of the configuration. * @return True if the configuration exists, otherwise false. @@ -299,6 +316,8 @@ public boolean contains(String name) { } /** + * Clones this Configuration object. + * * @return A clone of the Configuration object. */ @SuppressWarnings("CloneDoesntCallSuperClone")