ReferenceBeanBuilder extends AbstractAnnotationConfigBeanBuilder<Reference, ReferenceBean> { public static ReferenceBeanBuilder create(Reference annotation, ClassLoader classLoader, ApplicationContext applicationContext) { return new ReferenceBeanBuilder(annotation, classLoader, applicationContext); } private  ReferenceBeanBuilder(Reference annotation, ClassLoader classLoader, ApplicationContext applicationContext); static ReferenceBeanBuilder create(Reference annotation, ClassLoader classLoader,
                                              ApplicationContext applicationContext);  }
@Test public void testBuild() throws Exception { Reference reference = findAnnotation(findField(getClass(), "TEST_FIELD"), Reference.class); ReferenceBeanBuilder beanBuilder = ReferenceBeanBuilder.create(reference, context.getClassLoader(), context); beanBuilder.interfaceClass(CharSequence.class); ReferenceBean referenceBean = beanBuilder.build(); Assert.assertEquals(CharSequence.class, referenceBean.getInterfaceClass()); Assert.assertEquals("1.0.0", referenceBean.getVersion()); Assert.assertEquals("TEST_GROUP", referenceBean.getGroup()); Assert.assertEquals("dubbo: Assert.assertEquals("client", referenceBean.getClient()); Assert.assertEquals(true, referenceBean.isGeneric()); Assert.assertEquals(true, referenceBean.isInjvm()); Assert.assertEquals(false, referenceBean.isCheck()); Assert.assertEquals(null, referenceBean.isInit()); Assert.assertEquals(true, referenceBean.getLazy()); Assert.assertEquals(true, referenceBean.getStubevent()); Assert.assertEquals("reconnect", referenceBean.getReconnect()); Assert.assertEquals(true, referenceBean.getSticky()); Assert.assertEquals("javassist", referenceBean.getProxy()); Assert.assertEquals("java.lang.CharSequence", referenceBean.getStub()); Assert.assertEquals("failover", referenceBean.getCluster()); Assert.assertEquals(Integer.valueOf(3), referenceBean.getConnections()); Assert.assertEquals(Integer.valueOf(1), referenceBean.getCallbacks()); Assert.assertEquals("onconnect", referenceBean.getOnconnect()); Assert.assertEquals("ondisconnect", referenceBean.getOndisconnect()); Assert.assertEquals("owner", referenceBean.getOwner()); Assert.assertEquals("layer", referenceBean.getLayer()); Assert.assertEquals(Integer.valueOf(1), referenceBean.getRetries()); Assert.assertEquals("random", referenceBean.getLoadbalance()); Assert.assertEquals(true, referenceBean.isAsync()); Assert.assertEquals(Integer.valueOf(3), referenceBean.getActives()); Assert.assertEquals(true, referenceBean.getSent()); Assert.assertEquals("mock", referenceBean.getMock()); Assert.assertEquals("validation", referenceBean.getValidation()); Assert.assertEquals(Integer.valueOf(3), referenceBean.getTimeout()); Assert.assertEquals("cache", referenceBean.getCache()); Assert.assertEquals("echo,generic,accesslog", referenceBean.getFilter()); Assert.assertEquals("deprecated", referenceBean.getListener()); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("n1", "v1"); parameters.put("n2", "v2"); parameters.put("n3", "v3"); Assert.assertEquals(parameters, referenceBean.getParameters()); Assert.assertNull(referenceBean.getApplication()); Assert.assertNull(referenceBean.getModule()); Assert.assertNull(referenceBean.getConsumer()); Assert.assertNull(referenceBean.getMonitor()); Assert.assertEquals(Collections.emptyList(), referenceBean.getRegistries()); }