ClassToInstanceMap whose contents will never change, with many other important
properties detailed at ImmutableCollection.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ImmutableMap | |
| private static final ImmutableClassToInstanceMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <B> ImmutableClassToInstanceMap. | |
| public static <B, S extends B> ImmutableClassToInstanceMap | copyOf(Map<? extends Class<? extends S>, ? extends S>
a map)Map from which entries are drawn, must be non-nullHides java. map.
|
| protected Map | delegate()
Implements abstract com. |
| public <T extends B> T | getInstance(Class<T> type)
Implements com. null if no entry for this class
is present.
|
| public static <B> ImmutableClassToInstanceMap | |
| public static <B, T extends B> ImmutableClassToInstanceMap | of(Class<T>
the mapping's key type, T the mapping's value value)Hides java. ImmutableClassToInstanceMap containing a single entry.
|
| 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.
|
| pack-priv Object |
| delegate | back to summary |
|---|---|
| private final ImmutableMap<Class<? extends B>, B> delegate | |
| EMPTY | back to summary |
|---|---|
| private static final ImmutableClassToInstanceMap<Object> EMPTY | |
| ImmutableClassToInstanceMap | back to summary |
|---|---|
| private ImmutableClassToInstanceMap(ImmutableMap<Class<? extends B>, B> delegate) | |
| builder | back to summary |
|---|---|
| public static <B> ImmutableClassToInstanceMap. Returns a new builder. The generated builder is equivalent to the builder created by the | |
| copyOf | back to summary |
|---|---|
| public static <B, S extends B> ImmutableClassToInstanceMap Hides java. Returns an immutable map containing the same entries as Note Despite what the method name suggests, if
| |
| 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(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> ImmutableClassToInstanceMap Hides java. Returns an empty Performance note: the instance returned is a singleton.
| |
| of | back to summary |
|---|---|
| public static <B, T extends B> ImmutableClassToInstanceMap Hides java. Returns an
| |
| 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.
| |
| readResolve | back to summary |
|---|---|
| pack-priv Object readResolve() | |
static final ImmutableClassToInstanceMap<Handler> HANDLERS =
new ImmutableClassToInstanceMap.Builder<Handler>()
.put(FooHandler.class, new FooHandler())
.put(BarHandler.class, new SubBarHandler())
.put(Handler.class, new QuuxHandler())
.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 |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ImmutableClassToInstanceMap | build()
Returns a new immutable class-to-instance map containing the entries provided to this builder. |
| private static <T> T | |
| public <T extends B> ImmutableClassToInstanceMap. | |
| public <T extends B> ImmutableClassToInstanceMap. |
| mapBuilder | back to summary |
|---|---|
| private final ImmutableMap. | |
| Builder | back to summary |
|---|---|
| public Builder() | |
| build | back to summary |
|---|---|
| public ImmutableClassToInstanceMap Returns a new immutable class-to-instance map containing the entries provided to this builder.
| |
| cast | back to summary |
|---|---|
| private static <T> T cast(Class<T> type, Object value) | |
| put | back to summary |
|---|---|
| public <T extends B> ImmutableClassToInstanceMap. Associates
| |
| putAll | back to summary |
|---|---|
| public <T extends B> ImmutableClassToInstanceMap. Associates all of
| |