Class LedgerEntriesImpl

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<LedgerEntry>, LedgerEntries

    public class LedgerEntriesImpl
    extends java.lang.Object
    implements LedgerEntries
    Ledger entries implementation. It is a simple wrap of a list of ledger entries.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close to release the resources held by this instance.
      static LedgerEntriesImpl create​(java.util.List<LedgerEntry> entries)
      Create ledger entries.
      LedgerEntry getEntry​(long entryId)
      Gets a specific LedgerEntry by entryId.
      java.util.Iterator<LedgerEntry> iterator()
      Get an iterator over all the ledger entries contained in the LedgerEntries object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • create

        public static LedgerEntriesImpl create​(java.util.List<LedgerEntry> entries)
        Create ledger entries.
        Parameters:
        entries - the entries with ordering
        Returns:
        the LedgerEntriesImpl
      • getEntry

        public LedgerEntry getEntry​(long entryId)
        Gets a specific LedgerEntry by entryId.
        Specified by:
        getEntry in interface LedgerEntries
        Parameters:
        entryId - the LedgerEntry id
        Returns:
        the LedgerEntry, null if no LedgerEntry with such entryId
      • iterator

        public java.util.Iterator<LedgerEntry> iterator()
        Get an iterator over all the ledger entries contained in the LedgerEntries object.

        Calling this method does not modify the reference count of the ByteBuf in the returned LedgerEntry objects. The caller who calls LedgerEntries.iterator() should make sure that they do not call ByteBuf.release() on the LedgerEntry objects to avoid a double free. All reference counts will be decremented when the containing LedgerEntries object is closed via LedgerEntries.close().

        Specified by:
        iterator in interface java.lang.Iterable<LedgerEntry>
        Specified by:
        iterator in interface LedgerEntries
        Returns:
        an iterator of LedgerEntry objects
      • close

        public void close()
        Description copied from interface: LedgerEntries
        Close to release the resources held by this instance.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface LedgerEntries