Class EntitySchema<T>

java.lang.Object
dev.hogwai.dynamodb.simplified.entity.EntitySchema<T>
Type Parameters:
T - the entity type

public final class EntitySchema<T> extends Object
Captures the schema metadata for an entity type used in single-table designs.

Read from an entity class via EntitySchemaReader.read(Class). Provides access to the entity's discriminator, key components, and prefixes.

  • Method Details

    • entityClass

      public @NonNull Class<T> entityClass()
      Returns the entity class.
      Returns:
      the entity class
    • discriminator

      public @NonNull String discriminator()
      Returns the discriminator value for this entity type.
      Returns:
      the discriminator value
    • discriminatorAttribute

      public @NonNull String discriminatorAttribute()
      Returns the attribute name used to store the discriminator value.
      Returns:
      the discriminator attribute name
    • tableName

      public @NonNull String tableName()
      Returns the DynamoDB table name.
      Returns:
      the table name
    • computeKey

      public @Nullable String computeKey(@NonNull String component, @NonNull T entity)
      Computes a composite key value from the entity's annotated components.
      Parameters:
      component - the key component name (e.g. "PK" or "SK")
      entity - the entity instance to extract values from
      Returns:
      the computed key string, or null if no components match
    • keyComponents

      public @NonNull Set<String> keyComponents()
      Returns the set of key component names defined for this entity.
      Returns:
      the set of key component names
    • getKeyComponentInfo

      public @Nullable List<EntitySchema.KeyComponentInfo> getKeyComponentInfo(@NonNull String component)
      Returns the key component info for a given component name, or null.
      Parameters:
      component - the key component name
      Returns:
      the list of component info entries, or null if not found