MemoryRepository
classin packageklyn.data.memory
public class MemoryRepository<T, TId> implements Repository<T, TId>, MemoryRepositoryRegistration, MemoryIdentityLookup<T, TId>
MemoryRepository
All Implemented Interfaces: Repository, MemoryRepositoryRegistration, MemoryIdentityLookup<T, TId>

Read-only, no-tracking repository over an in-memory entity sequence.

Entity identity is obtained from the effective provider-neutral mapping: @Id, @EmbeddedId, or @IdClass. 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.

Example
import klyn.data.memory

users = MemoryRepository<User, Int>(fixtures)
active = query:
    from users user
    where user.active
Properties
Modifier and Type Member Description
public readonly property entityType
entityType as Type
Entity type exposed through MemoryConfiguration.
public readonly property identityType
identityType as Type
Exact identity type exposed through MemoryConfiguration.
Constructors
Modifier and Type Member Description
public MemoryRepository
MemoryRepository(values as IList<T>)
Creates a validated read-only repository.
Methods
Modifier and Type Member Description
public asQuery
asQuery() as Query<T>
Returns an immutable identity query over the repository.
public count
count() as Long
Returns the exact repository size.
public countPlan
countPlan(plan as QueryPlanBase) as Long
Counts plan results through the optimized memory plan path.
public executePlan
executePlan(plan as QueryPlanBase) as Object
Executes a typed plan directly over the repository snapshot.
public existsPlan
existsPlan(plan as QueryPlanBase) as Boolean
Tests plan existence through the optimized memory plan path.
public findIdentity
findIdentity(id as TId) as T
Returns one entity to the owning EntityManager, or null when absent.
public openStream
openStream(plan as QueryPlanBase) as Object
Opens an independent forward-only execution over the current rows.
public planExecutionMode
planExecutionMode(plan as QueryPlanBase) as ProviderExecutionMode
Memory plans execute through specialized local loops.
public planWarnings
planWarnings(plan as QueryPlanBase) as IList<String>
Memory execution introduces no implicit provider buffering.
public providerCapabilities
providerCapabilities() as ProviderCapabilities
Returns local-memory provider capabilities.
public providerDomain
providerDomain() as Object
Direct memory repositories share the local-memory execution domain.
public providerName
providerName() as String
Returns this provider's stable identifier.
public providerText
providerText(plan as QueryPlanBase) as String
Returns a redacted provider-plan description.
public repositoryObject
repositoryObject() as Object
Returns this concrete repository for heterogeneous configuration storage.
public validateBeforeRead
validateBeforeRead() as Repository<T, TId>
Revalidates every identity before reads requiring strict validation.