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

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.

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.
Inherited Properties
propertyInherited Properties from MemoryRepositoryRegistration: entityType, identityType
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 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.
Inherited Methods
methodInherited Methods from Repository: count, validateBeforeRead
methodInherited Methods from MemoryRepositoryRegistration: repositoryObject
methodInherited Methods from MemoryIdentityLookup: findIdentity
methodInherited Methods from Queryable: asQuery
methodInherited Methods from QuerySource: countPlan, executePlan, existsPlan, openStream, providerName, providerText