Annotation Interface Alias


@Documented @Target({FIELD,METHOD}) @Retention(RUNTIME) public @interface Alias
Marks a property whose current value is an alternative identifier for an entity or independently stored model.

Aliases are used when looking for an embedded entity via Entity.getEntity(Object), when resolving a legacy aggregate through Fluxzero.loadAggregateFor(Object, Class), and when loading an independent model through Fluxzero.loadModel(Object).

You can annotate fields and property methods. If a property value is a collection the members of the collection are all added as aliases of the entity. If the property value is null or an empty collection the alias is ignored.

On an independently stored Model, the complete current alias set is replaced atomically with each model transition. A changed or deleted alias therefore stops resolving after that commit. Such aliases identify a model globally and must be unique across independently stored models. Generic loads give a primary model ID precedence over an equal alias. Aliases which are intentionally local to one aggregate tree should not be exposed as independent-model aliases.

With fluxzero.model.aliasTargets=true, a mutation property with the same name as an alias property selects through that alias when no explicit Graph, association, primary-ID property or typed ID selects the Model. Alias prefix/postfix settings apply to the selector. Several alias properties (or collection values) must select one owner; the selected value must match each found selector on its declared property. Equal values on different alias properties are not interchangeable. A present but null primary-ID property does not enable alias fallback.

All missing selectors permit a new Apply result with a valid primary ID and matching selectors. Mixed found/missing selectors update the found owner and require the final result to match every selector. Fully matched selections may change aliases or delete the owner. Generic loads and embedded/legacy entity lookup keep their existing contract. Enable this only with a Runtime advertising identity-selection version 1; unsupported peers reject the new requests before effects. The setting defaults to false before defaults version 2026.10.18.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Adds given string as a postfix to the alias (if the property value is non-null).
    Adds given string as a prefix to the alias (if the property value is non-null).
  • Element Details

    • prefix

      String prefix
      Adds given string as a prefix to the alias (if the property value is non-null). Useful to prevent clashes with other entity ids.
      Default:
      ""
    • postfix

      String postfix
      Adds given string as a postfix to the alias (if the property value is non-null). Useful to prevent clashes with other entity ids.
      Default:
      ""