Class SimpleCatalog

java.lang.Object
com.amazon.ion.system.SimpleCatalog
All Implemented Interfaces:
IonCatalog, IonMutableCatalog, Iterable<SymbolTable>

public class SimpleCatalog extends Object implements IonMutableCatalog, Iterable<SymbolTable>
A basic implementation of IonCatalog as a hash table. There is no automatic removal of entries.
  • Constructor Details

    • SimpleCatalog

      public SimpleCatalog()
  • Method Details

    • getTable

      public SymbolTable getTable(String name)
      Description copied from interface: IonCatalog
      Gets a symbol table with a specific name and the highest version possible.
      Specified by:
      getTable in interface IonCatalog
      Parameters:
      name - identifies the desired symbol table.
      Returns:
      a shared symbol table with the given name, or null if this catalog has no table with the name.
    • getTable

      public SymbolTable getTable(String name, int version)
      Description copied from interface: IonCatalog
      Gets a desired symbol table from this catalog, using an exact match if possible.

      Implentations must make a best effort to find an exact match. If an exact match cannot be found, then this method must make a best effort to find the best match available.

      Specified by:
      getTable in interface IonCatalog
      Returns:
      the shared symbol table with the given name and version, when an exact match is possible. Otherwise, returns the lowest possible version larger than requested. Otherwise, return the largest possible version lower than requested. If no table with the name can be found, then this method returns null.
    • putTable

      public void putTable(SymbolTable table)
      Description copied from interface: IonMutableCatalog
      Adds a symbol table to this catalog. This interface does not define the behavior of this method if this catalog already contains a table with the same name and version.
      Specified by:
      putTable in interface IonMutableCatalog
      Parameters:
      table - must be shared but not a system table or substitute table.
    • removeTable

      public SymbolTable removeTable(String name, int version)
      Removes a symbol table from this catalog.
      Returns:
      the removed table, or null if this catalog has no matching table.
    • iterator

      public Iterator<SymbolTable> iterator()
      Constructs an iterator that enumerates all of the shared symbol tables in this catalog, at the time of method invocation. The result represents a snapshot of the state of this catalog.
      Specified by:
      iterator in interface Iterable<SymbolTable>
      Returns:
      a non-null, but potentially empty, iterator.