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 classcom.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 TypeMethodDescriptiongetTypeName(String alias) Returns the fully qualified class name associated with the given alias or type key.default Collection<String> Returns the fully qualified names that make up this registry.
-
Method Details
-
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
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@classin JSON- Returns:
- an
Optionalcontaining the resolved fully qualified class name, or empty if not found
-