Class ImmutableTypeToInstanceMap.Builder<B>

  • Enclosing class:
    ImmutableTypeToInstanceMap<B>

    @Beta
    @Deprecated(since="2022-12-01")
    public static final class ImmutableTypeToInstanceMap.Builder<B>
    extends java.lang.Object
    Deprecated.
    The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
    A builder for creating immutable type-to-instance maps. Example:
       
    
        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.

    Since:
    13.0
    • Method Detail

      • put

        public <T extends BImmutableTypeToInstanceMap.Builder<B> put​(java.lang.Class<T> key,
                                                                       T value)
        Deprecated.
        Associates key with value in the built map. Duplicate keys are not allowed, and will cause build() to fail.
      • build

        public ImmutableTypeToInstanceMap<B> build()
        Deprecated.
        Returns a new immutable type-to-instance map containing the entries provided to this builder.
        Throws:
        java.lang.IllegalArgumentException - if duplicate keys were added