Package org.proforma.variability.util
Class Ribbon<T>
java.lang.Object
org.proforma.variability.util.Ribbon<T>
- Type Parameters:
T
-
A Ribbon connects a data object of type T with a supplier and a consumer. A client of the ribbon can read the data object via the supplier and write or replace the data object via the supplier.
Example:
java.awt.Point p= new java.awt.Point(4,5); Ribbonrx= new Ribbon<>(() -> p.x, newx -> p.x= newx);
The previous example allows a client to read and replace the x coordinate of p, without knowing about the type of the whole object p.
The name "ribbon" comes from looking at it as a thing that is start and ending in itself, just like a printer ribbon.