ImmutableMap. See also MutableTypeToInstanceMap.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ImmutableMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <B> ImmutableTypeToInstanceMap. | |
| protected Map | delegate()
Implements abstract com. |
| public <T extends B> T | getInstance(TypeToken<T> type)
Implements com. null if no entry for this type is
present.
|
| public <T extends B> T | getInstance(Class<T> type)
Implements com. null if no entry for this class
is present.
|
| public static <B> ImmutableTypeToInstanceMap | |
| public B | put(TypeToken<? extends B>
key with which the specified value is to be associated key, B value to be associated with the specified key value)Overrides com. Implements java.
Deprecated
unsupported operation
Guaranteed to throw an exception and leave the map unmodified.
|
| public void | putAll(Map<? extends TypeToken<? extends B>, ? extends B>
mappings to be stored in this map map)Overrides com. Implements java.
Deprecated
unsupported operation
Guaranteed to throw an exception and leave the map unmodified.
|
| public <T extends B> T | putInstance(TypeToken<T> type, T value)
Implements com.
Deprecated
unsupported operation
Guaranteed to throw an exception and leave the map unmodified.
|
| public <T extends B> T | putInstance(Class<T> type, T value)
Implements com.
Deprecated
unsupported operation
Guaranteed to throw an exception and leave the map unmodified.
|
| private <T extends B> T |
| delegate | back to summary |
|---|---|
| private final ImmutableMap<TypeToken<? extends B>, B> delegate | |
| ImmutableTypeToInstanceMap | back to summary |
|---|---|
| private ImmutableTypeToInstanceMap(ImmutableMap<TypeToken<? extends B>, B> delegate) | |
| builder | back to summary |
|---|---|
| public static <B> ImmutableTypeToInstanceMap. Returns a new builder. | |
| delegate | back to summary |
|---|---|
| protected Map Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |
| getInstance | back to summary |
|---|---|
| public <T extends B> T getInstance(TypeToken<T> type) Implements com. Doc from com. Returns the value the specified type is mapped to, or
| |
| getInstance | back to summary |
|---|---|
| public <T extends B> T getInstance(Class<T> type) Implements com. Doc from com. Returns the value the specified class is mapped to, or
| |
| of | back to summary |
|---|---|
| public static <B> ImmutableTypeToInstanceMap Hides java. Returns an empty type to instance map.
| |
| put | back to summary |
|---|---|
| public B put(TypeToken<? extends B> key, B value) Overrides com. Implements java. Deprecated unsupported operation Guaranteed to throw an exception and leave the map unmodified.
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends TypeToken<? extends B>, ? extends B> map) Overrides com. Implements java. Deprecated unsupported operation Guaranteed to throw an exception and leave the map unmodified.
| |
| putInstance | back to summary |
|---|---|
| public <T extends B> T putInstance(TypeToken<T> type, T value) Implements com. Deprecated unsupported operation Guaranteed to throw an exception and leave the map unmodified.
| |
| putInstance | back to summary |
|---|---|
| public <T extends B> T putInstance(Class<T> type, T value) Implements com. Deprecated unsupported operation Guaranteed to throw an exception and leave the map unmodified.
| |
| trustedGet | back to summary |
|---|---|
private <T extends B> T trustedGet(TypeToken<T> type)
| |
static final ImmutableTypeToInstanceMap<Handler<?>> HANDLERS =
ImmutableTypeToInstanceMap.<Handler<?>>builder()
.put(new TypeToken<Handler<Foo>>() {}, new FooHandler())
.put(new TypeToken<Handler<Bar>>() {}, new SubBarHandler())
.build();
After invoking build() it is still possible to add more entries and build again.
Thus each map generated by this builder will be a superset of any map generated before it.
| Modifier and Type | Field and Description |
|---|---|
| private final ImmutableMap. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ImmutableTypeToInstanceMap | build()
Returns a new immutable type-to-instance map containing the entries provided to this builder. |
| public <T extends B> ImmutableTypeToInstanceMap. | |
| public <T extends B> ImmutableTypeToInstanceMap. |
| mapBuilder | back to summary |
|---|---|
| private final ImmutableMap. | |
| Builder | back to summary |
|---|---|
| private Builder() | |
| build | back to summary |
|---|---|
| public ImmutableTypeToInstanceMap Returns a new immutable type-to-instance map containing the entries provided to this builder.
| |
| put | back to summary |
|---|---|
| public <T extends B> ImmutableTypeToInstanceMap. Associates
| |
| put | back to summary |
|---|---|
| public <T extends B> ImmutableTypeToInstanceMap. Associates
| |