Class ImmutableValue


  • @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableValue
    extends Value
    Immutable implementation of Value.

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

    • Method Detail

      • getCreateIndex

        public long getCreateIndex()
        Specified by:
        getCreateIndex in class Value
        Returns:
        The value of the createIndex attribute
      • getModifyIndex

        public long getModifyIndex()
        Specified by:
        getModifyIndex in class Value
        Returns:
        The value of the modifyIndex attribute
      • getLockIndex

        public long getLockIndex()
        Specified by:
        getLockIndex in class Value
        Returns:
        The value of the lockIndex attribute
      • getKey

        public java.lang.String getKey()
        Specified by:
        getKey in class Value
        Returns:
        The value of the key attribute
      • getFlags

        public long getFlags()
        Specified by:
        getFlags in class Value
        Returns:
        The value of the flags attribute
      • getValue

        public java.util.Optional<java.lang.String> getValue()
        Specified by:
        getValue in class Value
        Returns:
        The value of the value attribute
      • getSession

        public java.util.Optional<java.lang.String> getSession()
        Specified by:
        getSession in class Value
        Returns:
        The value of the session attribute
      • withCreateIndex

        public final ImmutableValue withCreateIndex​(long value)
        Copy the current immutable object by setting a value for the createIndex attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for createIndex
        Returns:
        A modified copy of the this object
      • withModifyIndex

        public final ImmutableValue withModifyIndex​(long value)
        Copy the current immutable object by setting a value for the modifyIndex attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for modifyIndex
        Returns:
        A modified copy of the this object
      • withLockIndex

        public final ImmutableValue withLockIndex​(long value)
        Copy the current immutable object by setting a value for the lockIndex attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for lockIndex
        Returns:
        A modified copy of the this object
      • withKey

        public final ImmutableValue withKey​(java.lang.String value)
        Copy the current immutable object by setting a value for the key attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for key
        Returns:
        A modified copy of the this object
      • withFlags

        public final ImmutableValue withFlags​(long value)
        Copy the current immutable object by setting a value for the flags attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for flags
        Returns:
        A modified copy of the this object
      • withValue

        public final ImmutableValue withValue​(java.lang.String value)
        Copy the current immutable object by setting a present value for the optional value attribute.
        Parameters:
        value - The value for value
        Returns:
        A modified copy of this object
      • withValue

        public final ImmutableValue withValue​(java.util.Optional<java.lang.String> optional)
        Copy the current immutable object by setting an optional value for the value attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for value
        Returns:
        A modified copy of this object
      • withSession

        public final ImmutableValue withSession​(java.lang.String value)
        Copy the current immutable object by setting a present value for the optional session attribute.
        Parameters:
        value - The value for session
        Returns:
        A modified copy of this object
      • withSession

        public final ImmutableValue withSession​(java.util.Optional<java.lang.String> optional)
        Copy the current immutable object by setting an optional value for the session attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for session
        Returns:
        A modified copy of this object
      • equals

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

        public int hashCode()
        Computes a hash code from attributes: createIndex, modifyIndex, lockIndex, key, flags, value, session.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

        public java.util.Optional<java.lang.String> getValueAsString()

        Returns a lazily initialized value of the valueAsString attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.

        Overrides:
        getValueAsString in class Value
        Returns:
        A lazily initialized value of the valueAsString attribute
      • getValueAsBytes

        public java.util.Optional<byte[]> getValueAsBytes()

        Returns a lazily initialized value of the valueAsBytes attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.

        Overrides:
        getValueAsBytes in class Value
        Returns:
        A lazily initialized value of the valueAsBytes attribute
      • copyOf

        public static ImmutableValue copyOf​(Value instance)
        Creates an immutable copy of a Value 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 Value instance