public class MemoryRepository<T, TId> implements Repository<T, TId>, MemoryRepositoryRegistration, MemoryIdentityLookup<T, TId>:
Read-only, no-tracking repository over an in-memory entity sequence.
Entity identity is obtained from the unique property annotated with @Id. Existing lists are wrapped without copying, so constructing a repository is constant-space and queries observe the current list content. Keys are validated eagerly because the complete input is already available.
import klyn.data.memory users = MemoryRepository<User, Int>(fixtures) active = query: from users user where user.active
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | entityTypeentityType as Type: |
Entity type exposed through MemoryConfiguration. |
| public readonly property | identityTypeidentityType as Type: |
Exact identity type exposed through MemoryConfiguration. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | MemoryRepositoryMemoryRepository(values as IList<T>): |
Creates a validated read-only repository. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | asQueryasQuery() as Query<T>: |
Returns an immutable identity query over the repository. |
| public | countcount() as Long: |
Returns the exact repository size. |
| public | countPlancountPlan(plan as QueryPlanBase) as Long: |
Counts plan results through the optimized memory plan path. |
| public | executePlanexecutePlan(plan as QueryPlanBase) as Object: |
Executes a typed plan directly over the repository snapshot. |
| public | existsPlanexistsPlan(plan as QueryPlanBase) as Boolean: |
Tests plan existence through the optimized memory plan path. |
| public | findIdentityfindIdentity(id as TId) as T: |
Returns one entity to the owning EntityManager, or null when absent. |
| public | openStreamopenStream(plan as QueryPlanBase) as Object: |
Opens an independent forward-only execution over the current rows. |
| public | providerNameproviderName() as String: |
Returns this provider's stable identifier. |
| public | providerTextproviderText(plan as QueryPlanBase) as String: |
Returns a redacted provider-plan description. |
| public | repositoryObjectrepositoryObject() as Object: |
Returns this concrete repository for heterogeneous configuration storage. |
| public | validateBeforeReadvalidateBeforeRead() as Repository<T, TId>: |
Revalidates every identity before reads requiring strict validation. |