Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RowDataSnapshot usage - round 2 #147

Open
lemonboston opened this issue Dec 12, 2017 · 0 comments
Open

Improve RowDataSnapshot usage - round 2 #147

lemonboston opened this issue Dec 12, 2017 · 0 comments

Comments

@lemonboston
Copy link
Contributor

lemonboston commented Dec 12, 2017

Since the rowDataSnapshot.data(column, mapFunction) usage doesn't lend itself to used in lazy declarations, we can reconsider the interface and support classes again.

The proposal is to have String as return type and use Single and Optional adapters:

interface RowDataSnapshot<Contract> extends Iterable<String>
{
    Optional<String> stringData(String column);

    Optional<byte[]> byteData(String column);
}


Single<Color> color = new ColumnData<>(rowDataSnapshot, Tasks.COLOR, colorMapFunction);

Optional<Color> color = new OptionalColumnData<>(rowDataSnapshot, Tasks.COLOR, colorMapFunction);

For the common types we can create specific classes or use the general ones:

Single<Long> timestamp = new ColumnData<>(rowDataSnapshot, Tasks.TIME, Long::valueof);
Optional<Long> timestamp = new OptionalColumnData<>(rowDataSnapshot, Tasks.TIME, Long::valueof)

Single<Long> timestamp = new LongColumnData<>(rowDataSnapshot, Tasks.TIME);
Optional<Long> timestamp = new OptionalLongColumnData<>(rowDataSnapshot, Tasks.TIME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant