Class ImmutableClassToInstanceMap<B>

  • All Implemented Interfaces:
    ClassToInstanceMap<B>, java.util.Map<java.lang.Class<? extends B>,​B>

    @Deprecated(since="2022-12-01")
    public final class ImmutableClassToInstanceMap<B>
    extends ForwardingMap<java.lang.Class<? extends B>,​B>
    implements ClassToInstanceMap<B>
    Deprecated.
    The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
    A class-to-instance map backed by an ImmutableMap. See also MutableClassToInstanceMap.
    Since:
    2.0 (imported from Google Collections Library)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ImmutableClassToInstanceMap.Builder<B>
      Deprecated.
      The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Detail

      • copyOf

        public static <B,​S extends B> ImmutableClassToInstanceMap<B> copyOf​(java.util.Map<? extends java.lang.Class<? extends S>,​? extends S> map)
        Deprecated.
        Returns an immutable map containing the same entries as map. If map somehow contains entries with duplicate keys (for example, if it is a SortedMap whose comparator is not consistent with equals), the results of this method are undefined.

        Note: Despite what the method name suggests, if map is an ImmutableClassToInstanceMap, no copy will actually be performed.

        Throws:
        java.lang.NullPointerException - if any key or value in map is null
        java.lang.ClassCastException - if any value is not an instance of the type specified by its key
      • getInstance

        @Nullable
        public <T extends B> T getInstance​(java.lang.Class<T> type)
        Deprecated.
        Description copied from interface: ClassToInstanceMap
        Returns the value the specified class is mapped to, or null if no entry for this class is present. This will only return a value that was bound to this specific class, not a value that may have been bound to a subtype.
        Specified by:
        getInstance in interface ClassToInstanceMap<B>
      • putInstance

        @Deprecated
        public <T extends B> T putInstance​(java.lang.Class<T> type,
                                           T value)
        Deprecated.
        Unsupported operation.
        Guaranteed to throw an exception and leave the map unmodified.
        Specified by:
        putInstance in interface ClassToInstanceMap<B>
        Returns:
        the value previously associated with this class (possibly null), or null if there was no previous entry.
        Throws:
        java.lang.UnsupportedOperationException - always