@SuppressWarnings({"unchecked", "rawtypes"}) public JValidator(URL url) { this.clazz = ReflectUtils.forName(url.getServiceInterface()); String jvalidation = url.getParameter("jvalidation"); ValidatorFactory factory; if (jvalidation != null && jvalidation.length() > 0) { factory = Validation.byProvider((Class) ReflectUtils.forName(jvalidation)).configure().buildValidatorFactory(); } else { factory = Validation.buildDefaultValidatorFactory(); } this.validator = factory.getValidator(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public JValidator(URL url) { this.clazz = ReflectUtils.forName(url.getServiceInterface()); String jvalidation = url.getParameter("jvalidation"); ValidatorFactory factory; if (jvalidation != null && jvalidation.length() > 0) { factory = Validation.byProvider((Class)ReflectUtils.forName(jvalidation)).configure().buildValidatorFactory(); } else { factory = Validation.buildDefaultValidatorFactory(); } this.validator = factory.getValidator(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public JValidator(URL url) { this.clazz = ReflectUtils.forName(url.getServiceInterface()); String jvalidation = url.getParameter("jvalidation"); ValidatorFactory factory; if (jvalidation != null && jvalidation.length() > 0) { factory = Validation.byProvider((Class)ReflectUtils.forName(jvalidation)).configure().buildValidatorFactory(); } else { factory = Validation.buildDefaultValidatorFactory(); } this.validator = factory.getValidator(); }
private Throwable getThrowable(String throwstr) { Throwable throwable = (Throwable) throwables.get(throwstr); if (throwable != null) { return throwable; } else { Throwable t = null; try { Class<?> bizException = ReflectUtils.forName(throwstr); Constructor<?> constructor; constructor = ReflectUtils.findConstructor(bizException, String.class); t = (Throwable) constructor.newInstance(new Object[]{" mocked exception for Service degradation. "}); if (throwables.size() < 1000) { throwables.put(throwstr, t); } } catch (Exception e) { throw new RpcException("mock throw error :" + throwstr + " argument error.", e); } return t; } }
private Throwable getThrowable(String throwstr){ Throwable throwable =(Throwable) throwables.get(throwstr); if (throwable != null ){ return throwable; } else { Throwable t = null; try { Class<?> bizException = ReflectUtils.forName(throwstr); Constructor<?> constructor; constructor = ReflectUtils.findConstructor(bizException, String.class); t = (Throwable) constructor.newInstance(new Object[] {" mocked exception for Service degradation. "}); if (throwables.size() < 1000) { throwables.put(throwstr, t); } } catch (Exception e) { throw new RpcException("mock throw error :" + throwstr + " argument error.", e); } return t; } }
private Throwable getThrowable(String throwstr) { Throwable throwable = (Throwable) throwables.get(throwstr); if (throwable != null) { return throwable; } else { Throwable t = null; try { Class<?> bizException = ReflectUtils.forName(throwstr); Constructor<?> constructor; constructor = ReflectUtils.findConstructor(bizException, String.class); t = (Throwable) constructor.newInstance(new Object[]{" mocked exception for Service degradation. "}); if (throwables.size() < 1000) { throwables.put(throwstr, t); } } catch (Exception e) { throw new RpcException("mock throw error :" + throwstr + " argument error.", e); } return t; } }
private Throwable getThrowable(String throwstr){ Throwable throwable =(Throwable) throwables.get(throwstr); if (throwable != null ){ return throwable; } else { Throwable t = null; try { Class<?> bizException = ReflectUtils.forName(throwstr); Constructor<?> constructor; constructor = ReflectUtils.findConstructor(bizException, String.class); t = (Throwable) constructor.newInstance(new Object[] {" mocked exception for Service degradation. "}); if (throwables.size() < 1000) { throwables.put(throwstr, t); } } catch (Exception e) { throw new RpcException("mock throw error :" + throwstr + " argument error.", e); } return t; } }
public static Type[] getReturnTypes(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && !invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return new Type[]{method.getReturnType(), method.getGenericReturnType()}; } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Type[] getReturnTypes(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && ! invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return new Type[]{method.getReturnType(), method.getGenericReturnType()}; } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public <T> T getProxy(Invoker<T> invoker) throws RpcException { Class<?>[] interfaces = null; String config = invoker.getUrl().getParameter("interfaces"); if (config != null && config.length() > 0) { String[] types = Constants.COMMA_SPLIT_PATTERN.split(config); if (types != null && types.length > 0) { interfaces = new Class<?>[types.length + 2]; interfaces[0] = invoker.getInterface(); interfaces[1] = EchoService.class; for (int i = 0; i < types.length; i ++) { interfaces[i + 1] = ReflectUtils.forName(types[i]); } } } if (interfaces == null) { interfaces = new Class<?>[] {invoker.getInterface(), EchoService.class}; } return getProxy(invoker, interfaces); }
public <T> T getProxy(Invoker<T> invoker) throws RpcException { Class<?>[] interfaces = null; String config = invoker.getUrl().getParameter("interfaces"); if (config != null && config.length() > 0) { String[] types = Constants.COMMA_SPLIT_PATTERN.split(config); if (types != null && types.length > 0) { interfaces = new Class<?>[types.length + 2]; interfaces[0] = invoker.getInterface(); interfaces[1] = EchoService.class; for (int i = 0; i < types.length; i ++) { interfaces[i + 1] = ReflectUtils.forName(types[i]); } } } if (interfaces == null) { interfaces = new Class<?>[] {invoker.getInterface(), EchoService.class}; } return getProxy(invoker, interfaces); }
public static Type[] getReturnTypes(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && !invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return new Type[]{method.getReturnType(), method.getGenericReturnType()}; } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Class<?> getReturnType(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && !invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return method.getReturnType(); } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Class<?> getReturnType(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && !invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return method.getReturnType(); } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Class<?> getReturnType(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && ! invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return method.getReturnType(); } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Class<?> getReturnType(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && ! invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return method.getReturnType(); } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }
public static Class<?>[] getParameterTypes(Invocation invocation) { if (Constants.$INVOKE.equals(invocation.getMethodName()) && invocation.getArguments() != null && invocation.getArguments().length > 1 && invocation.getArguments()[1] instanceof String[]) { String[] types = (String[]) invocation.getArguments()[1]; if (types == null) { return new Class<?>[0]; } Class<?>[] parameterTypes = new Class<?>[types.length]; for (int i = 0; i < types.length; i++) { parameterTypes[i] = ReflectUtils.forName(types[0]); } return parameterTypes; } return invocation.getParameterTypes(); }
public static Class<?>[] getParameterTypes(Invocation invocation) { if (Constants.$INVOKE.equals(invocation.getMethodName()) && invocation.getArguments() != null && invocation.getArguments().length > 1 && invocation.getArguments()[1] instanceof String[]) { String[] types = (String[]) invocation.getArguments()[1]; if (types == null) { return new Class<?>[0]; } Class<?>[] parameterTypes = new Class<?>[types.length]; for (int i = 0; i < types.length; i++) { parameterTypes[i] = ReflectUtils.forName(types[0]); } return parameterTypes; } return invocation.getParameterTypes(); }
public static Class<?>[] getParameterTypes(Invocation invocation){ if(Constants.$INVOKE.equals(invocation.getMethodName()) && invocation.getArguments() != null && invocation.getArguments().length > 1 && invocation.getArguments()[1] instanceof String[]){ String[] types = (String[]) invocation.getArguments()[1]; if (types == null) { return new Class<?>[0]; } Class<?>[] parameterTypes = new Class<?>[types.length]; for (int i = 0; i < types.length; i ++) { parameterTypes[i] = ReflectUtils.forName(types[0]); } return parameterTypes; } return invocation.getParameterTypes(); }
public static Class<?>[] getParameterTypes(Invocation invocation){ if(Constants.$INVOKE.equals(invocation.getMethodName()) && invocation.getArguments() != null && invocation.getArguments().length > 1 && invocation.getArguments()[1] instanceof String[]){ String[] types = (String[]) invocation.getArguments()[1]; if (types == null) { return new Class<?>[0]; } Class<?>[] parameterTypes = new Class<?>[types.length]; for (int i = 0; i < types.length; i ++) { parameterTypes[i] = ReflectUtils.forName(types[0]); } return parameterTypes; } return invocation.getParameterTypes(); }