Class ImmutableCacheEntry

java.lang.Object
io.resys.hdes.client.api.ImmutableCacheEntry
All Implemented Interfaces:
HdesCache.CacheEntry, Serializable

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableCacheEntry extends Object implements HdesCache.CacheEntry
Immutable implementation of HdesCache.CacheEntry.

Use the builder to create immutable instances: ImmutableCacheEntry.builder().

See Also:
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface HdesCache.CacheEntry
      Returns:
      The value of the id attribute
    • getSource

      public AstBody.AstSource getSource()
      Specified by:
      getSource in interface HdesCache.CacheEntry
      Returns:
      The value of the source attribute
    • getAst

      public AstBody getAst()
      Specified by:
      getAst in interface HdesCache.CacheEntry
      Returns:
      The value of the ast attribute
    • getProgram

      public Optional<Program> getProgram()
      Specified by:
      getProgram in interface HdesCache.CacheEntry
      Returns:
      The value of the program attribute
    • withId

      public final ImmutableCacheEntry withId(String value)
      Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for id
      Returns:
      A modified copy of the this object
    • withSource

      public final ImmutableCacheEntry withSource(AstBody.AstSource value)
      Copy the current immutable object by setting a value for the source attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for source
      Returns:
      A modified copy of the this object
    • withAst

      public final ImmutableCacheEntry withAst(AstBody value)
      Copy the current immutable object by setting a value for the ast attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for ast
      Returns:
      A modified copy of the this object
    • withProgram

      public final ImmutableCacheEntry withProgram(Program value)
      Copy the current immutable object by setting a present value for the optional program attribute.
      Parameters:
      value - The value for program
      Returns:
      A modified copy of this object
    • withProgram

      public final ImmutableCacheEntry withProgram(Optional<? extends Program> optional)
      Copy the current immutable object by setting an optional value for the program attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for program
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableCacheEntry 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: id, source, ast, program.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableCacheEntry copyOf(HdesCache.CacheEntry instance)
      Creates an immutable copy of a HdesCache.CacheEntry value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable CacheEntry instance
    • builder

      public static ImmutableCacheEntry.Builder builder()
      Creates a builder for ImmutableCacheEntry.
       ImmutableCacheEntry.builder()
          .id(String) // required id
          .source(io.resys.hdes.client.api.ast.AstBody.AstSource) // required source
          .ast(io.resys.hdes.client.api.ast.AstBody) // required ast
          .program(io.resys.hdes.client.api.programs.Program) // optional program
          .build();
       
      Returns:
      A new ImmutableCacheEntry builder