public class ContextBuilder extends Object
RestContext or Injector instances based on the most commonly requested
arguments.
Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
If no Modules are specified, the default logging and
http transports will be installed.RestContext| Modifier and Type | Field and Description |
|---|---|
protected ApiMetadata |
apiMetadata |
protected String |
apiVersion |
protected String |
buildVersion |
protected String |
credential |
protected com.google.common.base.Optional<String> |
endpoint |
protected com.google.common.base.Optional<String> |
identity |
protected List<com.google.inject.Module> |
modules |
protected com.google.common.base.Optional<Properties> |
overrides |
protected String |
providerId |
protected com.google.common.base.Optional<ProviderMetadata> |
providerMetadata |
| Modifier | Constructor and Description |
|---|---|
|
ContextBuilder(ApiMetadata apiMetadata) |
protected |
ContextBuilder(ProviderMetadata providerMetadata) |
protected |
ContextBuilder(ProviderMetadata providerMetadata,
ApiMetadata apiMetadata) |
| Modifier and Type | Method and Description |
|---|---|
ContextBuilder |
apiVersion(String apiVersion) |
<C extends Context> |
build()
Builds the base context for this api.
|
<V extends View> |
build(Class<V> viewType) |
<C extends Context> |
build(com.google.common.reflect.TypeToken<C> contextType)
this will build the
context supported by the current ApiMetadata. |
com.google.inject.Injector |
buildInjector() |
static com.google.inject.Injector |
buildInjector(ProviderMetadata providerMetadata,
Credentials creds,
List<com.google.inject.Module> inputModules) |
ContextBuilder |
buildVersion(String buildVersion) |
<V extends View> |
buildView(Class<V> viewType) |
<V extends View> |
buildView(com.google.common.reflect.TypeToken<V> viewType)
this will build any
view supported by the ApiMetadata. |
ContextBuilder |
credentials(String identity,
String credential) |
ContextBuilder |
endpoint(String endpoint) |
ApiMetadata |
getApiMetadata() |
protected Properties |
getSystemProperties() |
ContextBuilder |
modules(Iterable<? extends com.google.inject.Module> modules) |
static ContextBuilder |
newBuilder(ApiMetadata apiMetadata) |
static ContextBuilder |
newBuilder(ProviderMetadata providerMetadata) |
static ContextBuilder |
newBuilder(String providerOrApi)
looks up a provider or api with the given id
|
ContextBuilder |
overrides(Properties overrides) |
static String |
searchPropertiesForProviderScopedProperty(Properties mutable,
String prov,
String key) |
String |
toString() |
protected com.google.common.base.Optional<ProviderMetadata> providerMetadata
protected final String providerId
protected com.google.common.base.Optional<String> endpoint
protected com.google.common.base.Optional<String> identity
protected ApiMetadata apiMetadata
protected String apiVersion
protected String buildVersion
protected com.google.common.base.Optional<Properties> overrides
protected List<com.google.inject.Module> modules
protected ContextBuilder(ProviderMetadata providerMetadata)
protected ContextBuilder(@Nullable ProviderMetadata providerMetadata, ApiMetadata apiMetadata)
public ContextBuilder(ApiMetadata apiMetadata)
public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException
providerOrApi - id of the provider or apiNoSuchElementException - if the id was not configured.public static ContextBuilder newBuilder(ApiMetadata apiMetadata)
public static ContextBuilder newBuilder(ProviderMetadata providerMetadata)
public ContextBuilder credentials(String identity, @Nullable String credential)
public ContextBuilder endpoint(String endpoint)
public ContextBuilder apiVersion(String apiVersion)
public ContextBuilder buildVersion(String buildVersion)
public ContextBuilder modules(Iterable<? extends com.google.inject.Module> modules)
public ContextBuilder overrides(Properties overrides)
public static String searchPropertiesForProviderScopedProperty(Properties mutable, String prov, String key) throws NoSuchElementException
NoSuchElementExceptionpublic com.google.inject.Injector buildInjector()
protected Properties getSystemProperties()
public static com.google.inject.Injector buildInjector(ProviderMetadata providerMetadata, Credentials creds, List<com.google.inject.Module> inputModules)
public <C extends Context> C build()
Closer, if nothing
else was configured via ApiMetadata.getContext(). Typically, the type returned is
RestContextApiMetadata.getContext(),
build(TypeToken)public <V extends View> V build(Class<V> viewType)
buildView(Class)public <V extends View> V buildView(Class<V> viewType)
buildView(TypeToken)public <V extends View> V buildView(com.google.common.reflect.TypeToken<V> viewType)
public <C extends Context> C build(com.google.common.reflect.TypeToken<C> contextType)
context supported by the current ApiMetadata.public ApiMetadata getApiMetadata()
Copyright © 2009-2012 jclouds. All Rights Reserved.