public interface Delegate<R,P>
Delegate is a function wrapped in an Object. Normally you will want to make an anonymous inner class implementing Delegate and pass that object somewhere. Delegate can be used as a generic listener (the delegate is invoked on an event) or some kind of other handler. If you need to use more than one parameter, you can use the com.gripstudios.utils.Tuples library.
If your delegate doesn't return a value, you can set it to return Object and then just return null or you can set the return value to Delegate.Void and return Delegate.VOID to make it clear that the return value means nothing.
Using Delegate class you can use some programming techniques readily available in functional programming languages allthough the syntax in Java becomes somewhat inconvenient.
Modifier and Type | Interface and Description |
---|---|
static class |
Delegate.Void |
Modifier and Type | Field and Description |
---|---|
static Delegate.Void |
VOID |
Modifier and Type | Method and Description |
---|---|
R |
invoke(P param) |
static final Delegate.Void VOID
Copyright 2004-2015 Wandora Team