Class AObject

java.lang.Object
convex.core.data.AObject
Direct Known Subclasses:
ACell, Context, Ref

public abstract class AObject extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Blob
    We cache the Blob for the binary encoding of this Cell
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Attach the given encoded Blob to this object Warning: Blob must be the correct canonical representation of this Cell, otherwise bad things may happen (incorrect hashcode, etc.)
    protected abstract Blob
    Creates a Blob object representing this object.
    Gets the encoded byte representation of this cell.
    final AString
    Prints this Object as a CVM String value, for human consumption.
    final AString
    print(long limit)
    Prints this Object as a CVM String value, for human consumption.
    abstract boolean
    print(BlobBuilder sb, long limit)
    Prints this Object to a readable String Representation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • encoding

      protected Blob encoding
      We cache the Blob for the binary encoding of this Cell
  • Constructor Details

    • AObject

      public AObject()
  • Method Details

    • print

      public abstract boolean print(BlobBuilder sb, long limit)
      Prints this Object to a readable String Representation. SECURITY: Must halt and return false in O(1) time when limit of printing is exceeded otherwise DoS attacks may be possible.
      Parameters:
      sb - BlobBuilder to append to. May be partially written if print limit exceeded
      limit - Limit of printing in string bytes
      Returns:
      True if fully printed within limit, false otherwise
    • print

      public final AString print()
      Prints this Object as a CVM String value, for human consumption. May include readable message indicating failure if print limit exceeded.
      Returns:
      String representation
    • print

      public final AString print(long limit)
      Prints this Object as a CVM String value, for human consumption. May include readable message indicating failure if print limit exceeded.
      Parameters:
      limit - Limit of bytes to print
      Returns:
      String representation
    • getEncoding

      public Blob getEncoding()
      Gets the encoded byte representation of this cell.
      Returns:
      A blob representing this cell in encoded form
    • createEncoding

      protected abstract Blob createEncoding()
      Creates a Blob object representing this object. Should be called only after the cached encoding has been checked.
      Returns:
      Blob Encoding of Object
    • attachEncoding

      public final void attachEncoding(Blob data)
      Attach the given encoded Blob to this object Warning: Blob must be the correct canonical representation of this Cell, otherwise bad things may happen (incorrect hashcode, etc.)
      Parameters:
      data - Encoding of Value. Must be a correct canonical encoding, or null to clear the cached encoding