1 15 package org.apache.hivemind.service.impl; 16 17 import java.lang.reflect.InvocationHandler ; 18 import java.lang.reflect.Method ; 19 import java.lang.reflect.Proxy ; 20 21 import org.apache.hivemind.Location; 22 import org.apache.hivemind.definition.ImplementationConstructionContext; 23 import org.apache.hivemind.internal.AbstractServiceImplementationConstructor; 24 25 30 public class JdkBeanInterfaceFactory extends AbstractServiceImplementationConstructor 31 { 32 33 public JdkBeanInterfaceFactory(Location location, String contributingModuleId) 34 { 35 super(location); 36 } 37 38 public Object constructCoreServiceImplementation(ImplementationConstructionContext context) 39 { 40 return createJdkBean(); 41 } 42 43 46 public static BeanInterface createJdkBean() { 47 return ( BeanInterface )Proxy.newProxyInstance( BeanInterface.class.getClassLoader(), new Class [] { BeanInterface.class }, new InvocationHandler () 48 { 49 public Object invoke(Object proxy, Method method, Object [] args) throws Throwable { 50 return "Hello, World!"; 51 } 52 } ); 53 } 54 55 56 } 57 | Popular Tags |