You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All new develpoment on cyclops occurs in cyclops-react. Older modules are still available in maven central.
The Decomposable Interface
Implementing com.aol.cyclops.lambda.api.Decomposable adds a default unapply method that decomposes the host Object into an Iterable over it's fields. This can be very useful for pattern matching recursively against fields.
Coercing to Decomposable
Any Object can be coerced to a Decomposable via the following methods
AsDecomposable.asDecomposable
As.asDecomposable
When unapply() is called on coerced Decomposable
If the Object is an iterable it will be returned
Otherwise, the values of the Object fields will be returned in an Immutable Array List
Example
With Lombok @Value
assertThat(As.asDecomposable(new MyCase("key",10))
.unapply(),equalTo(Arrays.asList("key",10)));
@Value static class MyCase { String key; int value;}