Class EntityMetadata

java.lang.Object
io.fluxzero.sdk.modeling.EntityMetadata

public final class EntityMetadata extends Object
Cached structural metadata for an entity, persisted root, or type containing model handlers.

Instances are owned by ReflectionUtils.TypeMetadata; callers must use of(Class) instead of constructing or caching this metadata independently.

  • Method Details

    • of

      public static EntityMetadata of(Class<?> type)
      Returns the centrally cached entity metadata for a Java type.
    • validate

      public static EntityMetadata validate(Class<?> type)
      Returns and validates the centrally cached metadata, including all statically typed parent relations reachable from this type.

      Same-type recursive relations and relations using untyped IDs are checked for concrete ID cycles when their relationship deltas are committed.

    • acceptsPayload

      public static boolean acceptsPayload(EntityMetadata.HandlerMethod handler, Class<?> payloadType)
      Returns whether a model handler can structurally consume the supplied payload type.
    • compatibleTypes

      public static boolean compatibleTypes(Class<?> left, Class<?> right)
      Returns whether two declared model types can describe the same runtime value.
    • type

      public Class<?> type()
      Returns the class described by this entity metadata.
    • isModel

      public boolean isModel()
      Returns whether the type carries Model configuration.
    • localModelName

      public String localModelName()
      Returns the prefix-independent durable name of this concrete Model type.
    • revision

      public int revision()
      Returns this type's serializer revision.
    • rootConfiguration

      public Optional<EntityMetadata.RootConfiguration> rootConfiguration()
      Returns aggregate-neutral persistence settings for an explicitly annotated root.
    • entityId

      public Optional<EntityMetadata.Property> entityId()
      Returns the entity identifier property, if one was discovered.
    • repositoryId

      public String repositoryId(Object functionalId)
      Returns the exact repository identity for a functional identifier of this type.

      When the entity property is an Id subtype, a String input is interpreted as that ID's functional value, so the ID's own repository prefix is applied before the outer EntityId affixes.

    • repositoryIdOf

      public String repositoryIdOf(Object value)
      Returns the exact repository identity read from this type's EntityId property.
    • parentScopedEntityId

      public boolean parentScopedEntityId()
      Returns whether this model's persisted identity is scoped by a parent relationship.
    • functionalIdOf

      public Object functionalIdOf(Object value)
      Returns the functional value held by this type's EntityId property.
    • identifies

      public boolean identifies(String repositoryId, Object value)
      Returns whether a non-null model value carries the supplied exact repository identity.
    • repositoryId

      public String repositoryId(Object functionalId, Object parentId, Class<?> parentType)
      Resolves a parent-scoped primary identity from a functional child ID and explicit parent.
    • repositoryId

      public String repositoryId(Object functionalId, Object source)
      Returns the repository identity for a known functional ID, reading parent scope from the supplied source only when this model explicitly opted into parent-scoped identity.
    • hasAliases

      public boolean hasAliases()
      Whether this model declares at least one independently persisted alias.
    • aliases

      public List<String> aliases(Object value)
      Returns the complete aliases declared by the supplied model value, or null when its type does not participate in independent-model alias persistence.
    • parentReferences

      public List<EntityMetadata.ParentReference> parentReferences()
      Returns the discovered parent-reference descriptors for this type.
    • parentRelationships

      public List<EntityMetadata.ParentRelationship> parentRelationships(String modelId, Object value)
      Resolves and deduplicates the outgoing parent relationships of one model value.

      This is the only runtime extraction of Parent values. Graph views, batch overlays, cascade selection and repository commits consume this immutable result instead of independently reading structural metadata.

    • participatesInGraphComposition

      public boolean participatesInGraphComposition()
      Whether this model is placed in an automatically composed graph through at least one explicit parent path.

      Graph participation is independent from Model.persistence(): a Model can supply an internal current document for composition without exposing a direct document through its own collection.

    • maintainsGraphComponentDocument

      public boolean maintainsGraphComponentDocument()
      Whether this Model independently needs an indexed internal current document for Graph operations.
    • isSearchable

      public boolean isSearchable()
      Whether an explicit request on this type or a composed ancestor includes this node type in search.
    • graphComposition

      public ModelGraphComposition graphComposition()
      Scope of a Graph query rooted here, independent of the root's inherited activation.
    • modelDocumentCollection

      public Optional<String> modelDocumentCollection()
      Returns this Model's canonical current-document collection, if maintained.
    • modelDocumentCollection

      public Optional<String> modelDocumentCollection(String modelNamePrefix)
      Returns this Model's canonical collection using an application-scoped name prefix.
    • modelSourceDocumentCollection

      public Optional<String> modelSourceDocumentCollection(String modelNamePrefix)
      Internal state and indexed node search share one canonical document; search never changes load authority.
    • modelDocumentReadCollection

      public String modelDocumentReadCollection()
      Returns the collection queried for a current document, including the historical empty-document fallback for a non-event-sourced Model that does not materialize one itself.
    • modelDocumentReadCollection

      public String modelDocumentReadCollection(String modelNamePrefix)
      Returns the read collection using an already application-scoped name prefix.
    • configuredModelDocumentCollection

      public String configuredModelDocumentCollection(String modelNamePrefix)
      Returns the canonical Model source collection, shared with node search when enabled.
    • graphProjectionConfiguration

      public Optional<ModelGraphProjectionConfiguration> graphProjectionConfiguration()
      Returns this root's application-resolved materialized graph definition, if enabled.
    • graphProjectionConfiguration

      public Optional<ModelGraphProjectionConfiguration> graphProjectionConfiguration(Collection<Class<?>> knownModelTypes)
      Returns this root's durable graph definition including every known model schema that can be placed below it.
    • graphProjectionConfiguration

      public Optional<ModelGraphProjectionConfiguration> graphProjectionConfiguration(Collection<Class<?>> knownModelTypes, String modelNamePrefix)
      Returns the durable Graph definition using an already application-scoped Model-name prefix.
    • graphSearchConfiguration

      public Optional<ModelGraphProjectionConfiguration> graphSearchConfiguration(Collection<Class<?>> knownModelTypes, String modelNamePrefix)
      Shared composition definition for both live and stored Graph search.
    • validateSearchScope

      public void validateSearchScope(Collection<Class<?>> knownModelTypes)
      Rejects a Graph scope whose declared child contract cannot maintain the required search source on every writer.
    • graphProjectionRoots

      public static List<EntityMetadata.GraphProjectionRoot> graphProjectionRoots(Class<?> modelType)
      Returns every materialized projection root reachable through this model's typed parent relationships.
    • graphProjectionRoots

      public static List<EntityMetadata.GraphProjectionRoot> graphProjectionRoots(Class<?> modelType, Collection<Class<?>> knownModelTypes)
      Includes registered concrete alternatives of polymorphic parent contracts, recursively through their ancestors. The result is a conservative type set; the Runtime selects actual affected roots from the changed Model IDs.
    • graphProjectionRoots

      public static List<EntityMetadata.GraphProjectionRoot> graphProjectionRoots(Class<?> modelType, Supplier<? extends Collection<Class<?>>> knownModelTypes)
      Avoids fetching or copying the application catalog for the usual final, statically declared parent types.
    • handlerMethods

      public List<EntityMetadata.HandlerMethod> handlerMethods()
      Returns the discovered entity handler methods and their kinds.
    • applyMethods

      public List<EntityMetadata.HandlerMethod> applyMethods()
    • scheduleParentReferences

      public static List<EntityMetadata.ParentReference> scheduleParentReferences(Class<?> payloadType)
      Returns cached parent declarations for a schedule payload without treating that payload as a Model. Composition settings do not add schedules to Graphs. Identity conversion uses the same contract as Models.