public Object invoke(Object proxy, Method method, Object[] args) { throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented."); } };
public TccClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":" + desc); if (mCopyConstructors == null) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
public TccClassGenerator addMethod(String name, Method m) { String desc = name + ReflectUtils.getDescWithoutMethodName(m); addMethod(':' + desc); if (mCopyMethods == null) mCopyMethods = new ConcurrentHashMap<String, Method>(8); mCopyMethods.put(desc, m); return this; }
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; } }
@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(); }
Class<?> type = types[i]; Object arg = args.get(i); if (ReflectUtils.isPrimitive(arg.getClass())) { if (! ReflectUtils.isPrimitive(type)) { return false; Class<?> cls = arg.getClass(); if (name != null && name.length() > 0) { cls = ReflectUtils.forName(name);
public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); }
public static boolean isPrimitives(Class<?> cls) { if (cls.isArray()) { return isPrimitive(cls.getComponentType()); } return isPrimitive(cls); }
public static Class<?> getGenericClass(Class<?> cls) { return getGenericClass(cls, 0); }
/** * get class array instance. * * @param desc desc. * @return Class class array. * @throws ClassNotFoundException */ public static Class<?>[] desc2classArray(String desc) throws ClassNotFoundException { Class<?>[] ret = desc2classArray(ClassHelper.getClassLoader(), desc); return ret; }
public static Method findMethodByMethodName(Class<?> clazz, String methodName) throws NoSuchMethodException, ClassNotFoundException { return findMethodByMethodSignature(clazz, methodName, null); }
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; } }
@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(); }
Class<?> type = types[i]; Object arg = args.get(i); if (ReflectUtils.isPrimitive(arg.getClass())) { if (! ReflectUtils.isPrimitive(type)) { return false; Class<?> cls = arg.getClass(); if (name != null && name.length() > 0) { cls = ReflectUtils.forName(name);
public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); }
public static boolean isPrimitives(Class<?> cls) { if (cls.isArray()) { return isPrimitive(cls.getComponentType()); } return isPrimitive(cls); }
public static Class<?> getGenericClass(Class<?> cls) { return getGenericClass(cls, 0); }
/** * get class array instance. * * @param desc desc. * @return Class class array. * @throws ClassNotFoundException */ public static Class<?>[] desc2classArray(String desc) throws ClassNotFoundException { Class<?>[] ret = desc2classArray(ClassHelper.getClassLoader(), desc); return ret; }
public static Method findMethodByMethodName(Class<?> clazz, String methodName) throws NoSuchMethodException, ClassNotFoundException { return findMethodByMethodSignature(clazz, methodName, null); }
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; } }