mirror of https://github.com/apache/jclouds.git
Added javadoc description for name property. Cleaned up code in ContextBuilder
This commit is contained in:
parent
420264cf73
commit
c086231b56
|
@ -47,7 +47,9 @@ import com.google.inject.ImplementedBy;
|
|||
public interface Context extends Location, Closeable {
|
||||
|
||||
/**
|
||||
* Identifies the Context.
|
||||
* Identifies the Context. This is a unique name optionally specified by the user and safe to index on.
|
||||
* The purpose of this property is to provide means to distinct between multiple contexts, without having to check
|
||||
* multiple properties or have explicit knowledge of how the context was created.
|
||||
* @return
|
||||
*/
|
||||
String getName();
|
||||
|
|
|
@ -259,9 +259,8 @@ public class ContextBuilder {
|
|||
ProviderMetadata providerMetadata = new UpdateProviderMetadataFromProperties(apiMetadata, this.providerMetadata).apply(expanded);
|
||||
|
||||
//We use either the specified name (optional) or a hash of provider/api, endpoint, api version & identity. Hash is used to be something readable.
|
||||
String name = this.name.isPresent() ? this.name.get() : String.valueOf(Objects.hashCode(providerMetadata.getId(), providerMetadata.getEndpoint() , apiVersion , identity.get()));
|
||||
|
||||
return buildInjector(name, providerMetadata, creds, modules);
|
||||
return buildInjector(name.or(String.valueOf(Objects.hashCode(providerMetadata.getId(),
|
||||
providerMetadata.getEndpoint() , apiVersion , identity.get()))), providerMetadata, creds, modules);
|
||||
}
|
||||
|
||||
private static String getAndRemove(Properties expanded, String key) {
|
||||
|
|
Loading…
Reference in New Issue