MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

generics/DynamicProxyMixin.java:46–60  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

44
45public class DynamicProxyMixin {
46 public static void main(String[] args) {
47 @SuppressWarnings("unchecked")
48 Object mixin = MixinProxy.newInstance(
49 tuple(new BasicImp(), Basic.class),
50 tuple(new TimeStampedImp(), TimeStamped.class),
51 tuple(new SerialNumberedImp(),
52 SerialNumbered.class));
53 Basic b = (Basic)mixin;
54 TimeStamped t = (TimeStamped)mixin;
55 SerialNumbered s = (SerialNumbered)mixin;
56 b.set("Hello");
57 System.out.println(b.get());
58 System.out.println(t.getStamp());
59 System.out.println(s.getSerialNumber());
60 }
61}
62/* Output:
63Hello

Callers

nothing calls this directly

Calls 6

newInstanceMethod · 0.95
setMethod · 0.95
getMethod · 0.95
getStampMethod · 0.95
getSerialNumberMethod · 0.95
tupleMethod · 0.80

Tested by

no test coverage detected