Package org.proforma.variability.util
Class Ribbon<T>
- java.lang.Object
-
- org.proforma.variability.util.Ribbon<T>
-
- Type Parameters:
T
-
public class Ribbon<T> extends Object implements Supplier<T>, Consumer<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); Ribbon
rx= 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(T t)
T
get()
String
getHint()
Supplier<T>
getSource()
Consumer<T>
getTarget()
void
setHint(String hint)
void
setSource(Supplier<T> source)
void
setTarget(Consumer<T> target)
-