Allows multiple objects implementing methods with different name or type (instance or static) but compatible signatures to be used interchangeably.
Delegates is conceptually similar to the notion of function pointers. Java does not provide Delegates
natively therefore the need for this implementation, see
A Java Programmer Looks at C# Delegates
article. See also Sun's critic of Delegates.
The introduction of the Delegates implementation in PerfectJPattern is more a means to componentize
some of the Design Patterns rather than offering Delegates as ultimate design building block for end
applications. The Delegates feature is nevertheless included in PerfectJPattern public API for cases
where would be needed e.g. it effectively abstracts from low-level Java Reflection machinery.
Notes about PerfectJPattern's Delegates implementation:
String
name. The tentative to build a
delegate over a method that no longer exists or its signature does not match, will result in a
predefined Runtime exception.