Annotation Interface RegisterType


@Retention(CLASS) @Target({PACKAGE,TYPE}) @Inherited public @interface RegisterType
Annotation to register a class or package for inclusion in the TypeRegistry.

Registered types are used to enable simplified type resolution, for example when deserializing JSON that references a type by name or when using TestFixture helpers to specify input/output types.

If this annotation is placed on a class, that class will be registered in the TypeRegistry. If placed on a package, all types in that package and its ancestor packages will be registered.

Types or packages marked with @RegisterType are discovered and indexed during annotation processing. This means that they must be available on the classpath at compile time, and annotation processing must be enabled for the type registry to function correctly.

Usage

Registered types can be referenced by:
  • Simple class name (e.g., "Foo")
  • Disambiguated name using trailing segments (e.g., "example.Foo")

This is especially useful when a type is referenced in serialized form using the "@class" attribute:

{
  "@class": "Foo",
  "name": "Example"
}

If multiple classes have the same simple name, Fluxzero will attempt to resolve the type using the shortest suffix that still uniquely identifies it (e.g., "billing.Foo" vs. "shipping.Foo"). If conflicts remain, the returned type is unpredictable.

Filtering using contains()

You can restrict which types are registered by specifying patterns to match against the class name:
@RegisterType(contains = {"Dto", "Request"})
This ensures that only classes whose names include "Dto" or "Request" will be registered.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional filters to determine which types should be registered based on name matching.
  • Element Details

    • contains

      String[] contains
      Optional filters to determine which types should be registered based on name matching.

      If this array is left empty (the default), all types in the annotated class or package are included. If provided, a type is only registered if one or more of these regular expressions match the class name.

      Returns:
      array of regex patterns used to match class names for registration
      Default:
      {}