@Test(expected = IllegalStateException.class) public void checkInterfaceAndMethod4() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setName("nihao"); InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.checkInterfaceAndMethods(Greeting.class, Collections.singletonList(methodConfig)); }
protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) { if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } if (methods != null && !methods.isEmpty()) { for (MethodConfig methodBean : methods) { String methodName = methodBean.getName(); if (methodName == null || methodName.length() == 0) { throw new IllegalStateException("<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"" + interfaceClass.getName() + "\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>"); } boolean hasMethod = false; for (java.lang.reflect.Method method : interfaceClass.getMethods()) { if (method.getName().equals(methodName)) { hasMethod = true; break; } } if (!hasMethod) { throw new IllegalStateException("The interface " + interfaceClass.getName() + " not found method " + methodName); } } } }
AbstractInterfaceConfig extends AbstractMethodConfig { protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) { if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } if (methods != null && !methods.isEmpty()) { for (MethodConfig methodBean : methods) { String methodName = methodBean.getName(); if (methodName == null || methodName.length() == 0) { throw new IllegalStateException("<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"" + interfaceClass.getName() + "\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>"); } boolean hasMethod = false; for (java.lang.reflect.Method method : interfaceClass.getMethods()) { if (method.getName().equals(methodName)) { hasMethod = true; break; } } if (!hasMethod) { throw new IllegalStateException("The interface " + interfaceClass.getName() + " not found method " + methodName); } } } } }
AbstractInterfaceConfig extends AbstractMethodConfig { protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) { if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } if (methods != null && !methods.isEmpty()) { for (MethodConfig methodBean : methods) { String methodName = methodBean.getName(); if (methodName == null || methodName.length() == 0) { throw new IllegalStateException("<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"" + interfaceClass.getName() + "\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>"); } boolean hasMethod = false; for (java.lang.reflect.Method method : interfaceClass.getMethods()) { if (method.getName().equals(methodName)) { hasMethod = true; break; } } if (!hasMethod) { throw new IllegalStateException("The interface " + interfaceClass.getName() + " not found method " + methodName); } } } }  }
AbstractInterfaceConfig extends AbstractMethodConfig { protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) { if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } if (methods != null && !methods.isEmpty()) { for (MethodConfig methodBean : methods) { String methodName = methodBean.getName(); if (methodName == null || methodName.length() == 0) { throw new IllegalStateException("<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"" + interfaceClass.getName() + "\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>"); } boolean hasMethod = false; for (java.lang.reflect.Method method : interfaceClass.getMethods()) { if (method.getName().equals(methodName)) { hasMethod = true; break; } } if (!hasMethod) { throw new IllegalStateException("The interface " + interfaceClass.getName() + " not found method " + methodName); } } } }  @Deprecated String getLocal(); @Deprecated void setLocal(Boolean local); @Deprecated void setLocal(String local); String getStub(); void setStub(Boolean stub); void setStub(String stub); String getCluster(); void setCluster(String cluster); String getProxy(); void setProxy(String proxy); Integer getConnections(); void setConnections(Integer connections); @Parameter(key = Constants.REFERENCE_FILTER_KEY, append = true) String getFilter(); void setFilter(String filter); @Parameter(key = Constants.INVOKER_LISTENER_KEY, append = true) String getListener(); void setListener(String listener); String getLayer(); void setLayer(String layer); ApplicationConfig getApplication(); void setApplication(ApplicationConfig application); ModuleConfig getModule(); void setModule(ModuleConfig module); RegistryConfig getRegistry(); void setRegistry(RegistryConfig registry); List<RegistryConfig> getRegistries(); @SuppressWarnings({"unchecked"}) void setRegistries(List<? extends RegistryConfig> registries); MonitorConfig getMonitor(); void setMonitor(String monitor); void setMonitor(MonitorConfig monitor); String getOwner(); void setOwner(String owner); Integer getCallbacks(); void setCallbacks(Integer callbacks); String getOnconnect(); void setOnconnect(String onconnect); String getOndisconnect(); void setOndisconnect(String ondisconnect); String getScope(); void setScope(String scope); }
AbstractInterfaceConfig extends AbstractMethodConfig { protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) { if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } if (methods != null && !methods.isEmpty()) { for (MethodConfig methodBean : methods) { String methodName = methodBean.getName(); if (methodName == null || methodName.length() == 0) { throw new IllegalStateException("<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"" + interfaceClass.getName() + "\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>"); } boolean hasMethod = false; for (java.lang.reflect.Method method : interfaceClass.getMethods()) { if (method.getName().equals(methodName)) { hasMethod = true; break; } } if (!hasMethod) { throw new IllegalStateException("The interface " + interfaceClass.getName() + " not found method " + methodName); } } } }  @Deprecated String getLocal(); @Deprecated void setLocal(Boolean local); @Deprecated void setLocal(String local); String getStub(); void setStub(Boolean stub); void setStub(String stub); String getCluster(); void setCluster(String cluster); String getProxy(); void setProxy(String proxy); Integer getConnections(); void setConnections(Integer connections); @Parameter(key = Constants.REFERENCE_FILTER_KEY, append = true) String getFilter(); void setFilter(String filter); @Parameter(key = Constants.INVOKER_LISTENER_KEY, append = true) String getListener(); void setListener(String listener); String getLayer(); void setLayer(String layer); ApplicationConfig getApplication(); void setApplication(ApplicationConfig application); ModuleConfig getModule(); void setModule(ModuleConfig module); RegistryConfig getRegistry(); void setRegistry(RegistryConfig registry); List<RegistryConfig> getRegistries(); @SuppressWarnings({"unchecked"}) void setRegistries(List<? extends RegistryConfig> registries); MonitorConfig getMonitor(); void setMonitor(String monitor); void setMonitor(MonitorConfig monitor); String getOwner(); void setOwner(String owner); Integer getCallbacks(); void setCallbacks(Integer callbacks); String getOnconnect(); void setOnconnect(String onconnect); String getOndisconnect(); void setOndisconnect(String ondisconnect); String getScope(); void setScope(String scope);  }