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.
  • Method Details

    • 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