Interface StorageValue

All Superinterfaces:
Comparable<StorageValue>, io.hotmoka.marshalling.api.Marshallable
All Known Subinterfaces:
BigIntegerValue, BooleanValue, ByteValue, CharValue, DoubleValue, FloatValue, IntValue, LongValue, NullValue, ShortValue, StorageReference, StringValue

public interface StorageValue extends io.hotmoka.marshalling.api.Marshallable, Comparable<StorageValue>
A value that can be stored in the store of a Hotmoka node, passed as argument or returned between the outside world and the node.
  • Method Details

    • equals

      boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      String toString()
      Overrides:
      toString in class Object
    • asBigInteger

      <E extends Exception> BigInteger asBigInteger(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a big integer, if it is a big integer.
      Type Parameters:
      E - the type of the exception thrown if this value is not a big integer
      Parameters:
      exception - the supplier of the exception thrown if this value is not a big integer
      Returns:
      the value, as a big integer
      Throws:
      E - if this value is not a big integer
    • asReturnedBigInteger

      <E extends Exception> BigInteger asReturnedBigInteger(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a big integer, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a big integer
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a big integer; it receives a string clarifying that the method was expected to return a big integer while it returned another kind of storage value
      Returns:
      the value, as a big integer
      Throws:
      E - if this value is not a big integer
    • asBoolean

      <E extends Exception> boolean asBoolean(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a boolean, if it is a boolean.
      Type Parameters:
      E - the type of the exception thrown if this value is not a boolean
      Parameters:
      exception - the supplier of the exception thrown if this value is not a boolean
      Returns:
      the value, as a boolean
      Throws:
      E - if this value is not a boolean
    • asReturnedBoolean

      <E extends Exception> boolean asReturnedBoolean(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a boolean, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a boolean
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a boolean; it receives a string clarifying that the method was expected to return a boolean while it returned another kind of storage value
      Returns:
      the value, as a boolean
      Throws:
      E - if this value is not a boolean
    • asByte

      <E extends Exception> byte asByte(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a byte, if it is a byte.
      Type Parameters:
      E - the type of the exception thrown if this value is not a byte
      Parameters:
      exception - the supplier of the exception thrown if this value is not a byte
      Returns:
      the value, as a byte
      Throws:
      E - if this value is not a byte
    • asReturnedByte

      <E extends Exception> byte asReturnedByte(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a byte, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a byte
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a byte; it receives a string clarifying that the method was expected to return a byte while it returned another kind of storage value
      Returns:
      the value, as a byte
      Throws:
      E - if this value is not a byte
    • asChar

      <E extends Exception> char asChar(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a char, if it is a char.
      Type Parameters:
      E - the type of the exception thrown if this value is not a char
      Parameters:
      exception - the supplier of the exception thrown if this value is not a char
      Returns:
      the value, as a char
      Throws:
      E - if this value is not a char
    • asReturnedChar

      <E extends Exception> char asReturnedChar(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a char, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a char
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a char; it receives a string clarifying that the method was expected to return a char while it returned another kind of storage value
      Returns:
      the value, as a char
      Throws:
      E - if this value is not a char
    • asDouble

      <E extends Exception> double asDouble(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a double, if it is a double.
      Type Parameters:
      E - the type of the exception thrown if this value is not a double
      Parameters:
      exception - the supplier of the exception thrown if this value is not a double
      Returns:
      the value, as a double
      Throws:
      E - if this value is not a double
    • asReturnedDouble

      <E extends Exception> double asReturnedDouble(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a double, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a double
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a double; it receives a string clarifying that the method was expected to return a double while it returned another kind of storage value
      Returns:
      the value, as a double
      Throws:
      E - if this value is not a double
    • asFloat

      <E extends Exception> float asFloat(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a float, if it is a float.
      Type Parameters:
      E - the type of the exception thrown if this value is not a float
      Parameters:
      exception - the supplier of the exception thrown if this value is not a float
      Returns:
      the value, as a float
      Throws:
      E - if this value is not a float
    • asReturnedFloat

      <E extends Exception> float asReturnedFloat(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a float, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a float
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a float; it receives a string clarifying that the method was expected to return a float while it returned another kind of storage value
      Returns:
      the value, as a float
      Throws:
      E - if this value is not a float
    • asInt

      <E extends Exception> int asInt(Function<StorageValue,? extends E> exception) throws E
      Yields this value as an int, if it is an int.
      Type Parameters:
      E - the type of the exception thrown if this value is not an int
      Parameters:
      exception - the supplier of the exception thrown if this value is not an int
      Returns:
      the value, as an int
      Throws:
      E - if this value is not an int
    • asReturnedInt

      <E extends Exception> int asReturnedInt(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as an int, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not an int
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not an int; it receives a string clarifying that the method was expected to return an int while it returned another kind of storage value
      Returns:
      the value, as an int
      Throws:
      E - if this value is not an int
    • asLong

      <E extends Exception> long asLong(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a long, if it is a long.
      Type Parameters:
      E - the type of the exception thrown if this value is not a long
      Parameters:
      exception - the supplier of the exception thrown if this value is not a long
      Returns:
      the value, as a long
      Throws:
      E - if this value is not a long
    • asReturnedLong

      <E extends Exception> long asReturnedLong(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a long, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a long
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a long; it receives a string clarifying that the method was expected to return a long while it returned another kind of storage value
      Returns:
      the value, as a long
      Throws:
      E - if this value is not a long
    • asShort

      <E extends Exception> short asShort(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a short, if it is a short.
      Type Parameters:
      E - the type of the exception thrown if this value is not a short
      Parameters:
      exception - the supplier of the exception thrown if this value is not a short
      Returns:
      the value, as a short
      Throws:
      E - if this value is not a short
    • asReturnedShort

      <E extends Exception> short asReturnedShort(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a short, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a short
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a short; it receives a string clarifying that the method was expected to return a short while it returned another kind of storage value
      Returns:
      the value, as a short
      Throws:
      E - if this value is not a short
    • asReference

      <E extends Exception> StorageReference asReference(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a reference, if it is a reference.
      Type Parameters:
      E - the type of the exception thrown if this value is not a reference
      Parameters:
      exception - the supplier of the exception thrown if this value is not a reference
      Returns:
      the value, as a reference
      Throws:
      E - if this value is not a reference
    • asReturnedReference

      <E extends Exception> StorageReference asReturnedReference(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a reference, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a reference
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a reference; it receives a string clarifying that the method was expected to return a reference while it returned another kind of storage value
      Returns:
      the value, as a reference
      Throws:
      E - if this value is not a reference
    • asString

      <E extends Exception> String asString(Function<StorageValue,? extends E> exception) throws E
      Yields this value as a string, if it is a string.
      Type Parameters:
      E - the type of the exception thrown if this value is not a string
      Parameters:
      exception - the supplier of the exception thrown if this value is not a string
      Returns:
      the value, as a string
      Throws:
      E - if this value is not a string
    • asReturnedString

      <E extends Exception> String asReturnedString(NonVoidMethodSignature method, Function<String,? extends E> exception) throws E
      Yields this value as a string, assuming that it is returned by the given method.
      Type Parameters:
      E - the type of the exception thrown if this value is not a string
      Parameters:
      method - the called method
      exception - the supplier of the exception thrown if this value is not a string; it receives a string clarifying that the method was expected to return a string while it returned another kind of storage value
      Returns:
      the value, as a string
      Throws:
      E - if this value is not a string