Interface TypeRegistry

All Known Implementing Classes:
DefaultTypeRegistry, NoOpTypeRegistry

public interface TypeRegistry
Interface for resolving registered types by alias or simplified name.

A TypeRegistry is used to look up the fully qualified class name associated with a given alias. Aliases may be:

  • Simple class names (e.g., "ProjectCreated")
  • Shortened fully qualified names (e.g., "project.ProjectCreated")

This mechanism is commonly used in deserialization of message payloads or documents, where the @class property in a JSON object indicates the type name.

Example

If a class com.example.project.ProjectCreated is registered using RegisterType, the registry may resolve:
getTypeName("ProjectCreated") -> "com.example.project.ProjectCreated"
getTypeName("project.ProjectCreated") -> "com.example.project.ProjectCreated"
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the fully qualified class name associated with the given alias or type key.
    Returns the fully qualified names that make up this registry.
  • Method Details

    • getTypeNames

      default Collection<String> getTypeNames()
      Returns the fully qualified names that make up this registry.

      Custom registries that only support alias lookup may retain the empty default. The standard registry exposes its generated catalog so structural metadata such as declared model relationships can be discovered without turning those types into message handlers.

    • getTypeName

      Optional<String> getTypeName(String alias)
      Returns the fully qualified class name associated with the given alias or type key.
      Parameters:
      alias - the name or alias to resolve, typically obtained from @class in JSON
      Returns:
      an Optional containing the resolved fully qualified class name, or empty if not found