Class ImmutableConstantCaptionProvider<C>

java.lang.Object
org.incendo.cloud.caption.ConstantCaptionProvider<C>
org.incendo.cloud.caption.ImmutableConstantCaptionProvider<C>
All Implemented Interfaces:
CaptionProvider<C>

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue @API(status=STABLE, consumers="org.incendo.cloud.*") public final class ImmutableConstantCaptionProvider<C> extends ConstantCaptionProvider<C>
Immutable implementation of ConstantCaptionProvider.

Use the builder to create immutable instances: ImmutableConstantCaptionProvider.builder(). Use the static factory method to create immutable instances: ImmutableConstantCaptionProvider.of().

  • Method Details

    • captions

      public @NonNull Map<Caption,String> captions()
      Returns all recognized captions and their corresponding constant values.
      Specified by:
      captions in class ConstantCaptionProvider<C>
      Returns:
      the captions
    • withCaptions

      public final ImmutableConstantCaptionProvider<C> withCaptions(Map<? extends Caption,? extends String> entries)
      Copy the current immutable object by replacing the captions map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the captions map
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableConstantCaptionProvider that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: captions.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ConstantCaptionProvider with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static <C> ImmutableConstantCaptionProvider<C> of(Map<? extends Caption,? extends String> captions)
      Construct a new immutable ConstantCaptionProvider instance.
      Type Parameters:
      C - generic parameter C
      Parameters:
      captions - The value for the captions attribute
      Returns:
      An immutable ConstantCaptionProvider instance
    • copyOf

      public static <C> ImmutableConstantCaptionProvider<C> copyOf(ConstantCaptionProvider<C> instance)
      Creates an immutable copy of a ConstantCaptionProvider value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      C - generic parameter C
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ConstantCaptionProvider instance
    • builder

      public static <C> ImmutableConstantCaptionProvider.Builder<C> builder()
      Creates a builder for ImmutableConstantCaptionProvider.
       ImmutableConstantCaptionProvider.&lt;C&gt;builder()
          .putCaption|putAllCaptions(org.incendo.cloud.caption.Caption => String) // captions mappings
          .build();
       
      Type Parameters:
      C - generic parameter C
      Returns:
      A new ImmutableConstantCaptionProvider builder