I find abstraction for getting and filtering events a bit complicated:
OpenShift class returns EventList instance which is implements List<Event> . The class provides filter method that returns EventListFilter instance that encapsulate functionality over the stream of events for filtering and collecting purpose.
This is IMHO too complicated and does not serve the purpose. What I suggest:
- Getting rid of EventList class.
- Do not encapsulate the filtering but rather have a class that provides predicates for filtering purposes - functionality would be the same.
Scenario:
Now:
Method foo needs certain events. It gets EventList, then EventListFilter and call some methods to filter events and then collect it.
If there is need of custom filtration it needs to be implemented in EventListFilter or foo method get the stream from EventListFilter and work on it that way.
Cons: it is not very easy to use
After:
Method foo needs certain events. It gets List<Event> from OpenShift and then work over the stream in standard way. It may use EventFilters class that provides Predicate<Event> instances (same functionality as in EventListFilter)
Pros: standard way of use stream, filters and so on. Easy to use
How to get there:
I find abstraction for getting and filtering events a bit complicated:
OpenShift class returns EventList instance which is implements List<Event> . The class provides filter method that returns EventListFilter instance that encapsulate functionality over the stream of events for filtering and collecting purpose.
This is IMHO too complicated and does not serve the purpose. What I suggest:
Scenario:
Now:
Method foo needs certain events. It gets EventList, then EventListFilter and call some methods to filter events and then collect it.
If there is need of custom filtration it needs to be implemented in EventListFilter or foo method get the stream from EventListFilter and work on it that way.
Cons: it is not very easy to use
After:
Method foo needs certain events. It gets List<Event> from OpenShift and then work over the stream in standard way. It may use EventFilters class that provides Predicate<Event> instances (same functionality as in EventListFilter)
Pros: standard way of use stream, filters and so on. Easy to use
How to get there: