Generics

Building blocks can make use of Java Generics to be adaptable to a certain type. For instance, the Reactive Buffer block works on any type of objects that can be buffered. If you instantiate a reactive buffer, its pins add and out refer to the type java.lang.Object:

In the given case, we want to work with objects of type SMS instead. Luckily, the Reactive Buffer block may be adapted to that type. From the context menu, select “Parameters and Generics…” and adjust the type. The result is shown below. Pins add and out refer now to the type SMS.

Declaring Generic Types

To declare generic types, add the declarations into the class signature like you would normally do in Java, and use them like any type within the building block.