Class SimpleSchemaRegistry

java.lang.Object
ai.badmonkey.agentspaces.space.local.SimpleSchemaRegistry
All Implemented Interfaces:
SchemaRegistry

public final class SimpleSchemaRegistry extends Object implements SchemaRegistry
The default schema registry: names a type <fully.qualified.Name>#v1. Writer/reader schema evolution (spec ยง14) will refine this; the name format is already versioned so that refinement stays compatible.
  • Constructor Details

    • SimpleSchemaRegistry

      public SimpleSchemaRegistry()
  • Method Details

    • register

      public String register(Class<?> entryType)
      Description copied from interface: SchemaRegistry
      Registers an entry type and returns its schema name. Idempotent.
      Specified by:
      register in interface SchemaRegistry
      Parameters:
      entryType - the entry class
      Returns:
      the schema name
    • schemaNameOf

      public String schemaNameOf(Class<?> entryType)
      Description copied from interface: SchemaRegistry
      Returns the schema name of a registered type.
      Specified by:
      schemaNameOf in interface SchemaRegistry
      Parameters:
      entryType - the entry class
      Returns:
      the schema name
    • classFor

      public Optional<Class<?>> classFor(String schemaName)
      Description copied from interface: SchemaRegistry
      Resolves a schema name back to a registered class, when this JVM knows it.
      Specified by:
      classFor in interface SchemaRegistry
      Parameters:
      schemaName - the schema name
      Returns:
      the class, or empty when unknown here