Skip to content

Storages and delegation #1243

@dmdashenkov

Description

@dmdashenkov

Currently, it is not easy to create an implementation of, e.g. ProjectionStorage, which would delegate its operations to another instance of ProjectionStorage.

The problem is in protected methods.

package org.example;

// ...

class MyProjectionStorage<I> extends ProjectionStorage<I> {

    private final ProjectionStorage<I> delegate;

    @Override
    protected Optional<EntityRecord> readRecord(I id) {
        return delagate.readRecord(id); 
        //              ^
        // Compiler error here, cannot access protected method `readRecord`
        //  outside the Spine package.
    }
    
    // ...
}

There are a few methods in ProjectionStorage and other case-specific storages such as readRecord, which are declared protected making it impossible to delegate them.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions