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

Add support for nested builders on octets fields instead of visitors #63

Open
cmebarrow opened this issue Mar 20, 2018 · 1 comment
Open

Comments

@cmebarrow
Copy link

cmebarrow commented Mar 20, 2018

Objective is to be able to write code like the following:

        private final SseEventFW.Builder sseEventRW = new SseEventFW.Builder();

        DataFW data = dataRW.wrap(writeBuffer, 0, writeBuffer.capacity())
            .streamId(targetId)
            .groupId(0)
            .padding(padding)
            .payload(sseEventRW)
                .data(data)
                .timestamp(timestamp)
                .id(id)
                .type(type)
                .build()
            .build();

instead of

       final Consumer<Builder> payloadMutator = timestampRequested ?
               p -> p.set(visitSseEvent(eventData, id, type, timestamp)):
               p -> p.set(visitSseEvent(eventData, id, type));

       DataFW data = dataRW.wrap(writeBuffer, 0, writeBuffer.capacity())
           .streamId(targetId)
           .groupId(0)
           .padding(padding)
           .payload(payloadMutator)
           .build();

Purpose is to avoid the use of lambdas to improve performance and make coding easier.

@cmebarrow
Copy link
Author

This may require enhancing FlyWeight.Builder to take an optional second type parameter indicating the outer builder type to be returned from build(), or adding a parameterized variant of wrap indicating the same information.

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