private void addMethods(Class<?> cls, ClassFile proxyClassType, ClassMethod staticConstructor) { for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { if (isMethodAccepted(method, getProxySuperclass())) { try { MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); addConstructedGuardToMethodBody(classMethod); createForwardingMethodBody(classMethod, methodInfo, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); } catch (DuplicateMemberException e) { // do nothing. This will happen if superclass methods // have been overridden } } } }
for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { && !finalMethods.contains(methodSignature) && !processedBridgeMethods.contains(methodSignature)) { try { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); && !processedBridgeMethods.contains(signature)) { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); throw new WeldException(e);
protected void addMethodsFromClass(ClassFile proxyClassType, ClassMethod staticConstructor) { try { Class<?> cls = getBeanType(); generateEqualsMethod(proxyClassType); generateHashCodeMethod(proxyClassType); if (isMethodAccepted(method, getProxySuperclass())) { try { MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); if (Reflections.isDefault(method)) { addConstructedGuardToMethodBody(classMethod); createSpecialMethodBody(classMethod, methodInfo, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); } catch (DuplicateMemberException e) { throw new WeldException(e);
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); final ClassMethod classMethod = proxyClassType.addMethod(method); createInterceptorBody(classMethod, methodInfo, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass"); MethodInformation getInstanceMethodInfo = new RuntimeMethodInformation(getInstanceMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceMethod), getInstanceMethodInfo, staticConstructor); MethodInformation getInstanceClassMethodInfo = new RuntimeMethodInformation(getInstanceClassMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceClassMethod), getInstanceClassMethodInfo, staticConstructor); Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); createInterceptorBody(proxyClassType.addMethod(method), methodInfo, false, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass"); generateGetTargetInstanceBody(proxyClassType.addMethod(getInstanceMethod)); generateGetTargetClassBody(proxyClassType.addMethod(getInstanceClassMethod)); Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
decoratorMethods(cls, methods); for (Method method : methods) { MethodInformation methodInfo = new RuntimeMethodInformation(method); if (!method.getDeclaringClass().getName().equals("java.lang.Object") || method.getName().equals("toString")) { createDelegateInitializerCode(proxyClassType.addMethod(method), methodInfo, delegateParameterPosition); createAbstractMethodCode(proxyClassType.addMethod(method), methodInfo, staticConstructor); throw new WeldException(e);
@Override protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { super.addSpecialMethods(proxyClassType, staticConstructor); // Add methods for the EnterpriseBeanInstance interface try { proxyClassType.addInterface(EnterpriseBeanInstance.class.getName()); for (Method method : EnterpriseBeanInstance.class.getMethods()) { BeanLogger.LOG.addingMethodToEnterpriseProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); createInterceptorBody(proxyClassType.addMethod(method), methodInfo, staticConstructor); } } catch (Exception e) { throw new WeldException(e); } }
while (cls != null) { Set<MethodSignature> declaredBridgeMethods = new HashSet<MethodSignature>(); for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { && !finalMethods.contains(methodSignature) && !processedBridgeMethods.contains(methodSignature)) { try { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); && !finalMethods.contains(signature) && !processedBridgeMethods.contains(signature)) { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); if (interceptedMethodSignatures.contains(signature) && Reflections.isDefault(method)) { BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); throw new WeldException(e);
protected void addMethodsFromClass(ClassFile proxyClassType, ClassMethod staticConstructor) { try { Class<?> cls = getBeanType(); generateEqualsMethod(proxyClassType); generateHashCodeMethod(proxyClassType); if (isMethodAccepted(method, getProxySuperclass())) { try { MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); if (Reflections.isDefault(method)) { addConstructedGuardToMethodBody(classMethod); createSpecialMethodBody(classMethod, methodInfo, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); } catch (DuplicateMemberException e) { throw new WeldException(e);
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); final ClassMethod classMethod = proxyClassType.addMethod(method); createInterceptorBody(classMethod, methodInfo, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("getTargetClass"); MethodInformation getInstanceMethodInfo = new RuntimeMethodInformation(getInstanceMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceMethod), getInstanceMethodInfo, staticConstructor); MethodInformation getInstanceClassMethodInfo = new RuntimeMethodInformation(getInstanceClassMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceClassMethod), getInstanceClassMethodInfo, staticConstructor); Method setMethodHandlerMethod = ProxyObject.class.getMethod("setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); createInterceptorBody(proxyClassType.addMethod(method), methodInfo, false, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass"); generateGetTargetInstanceBody(proxyClassType.addMethod(getInstanceMethod)); generateGetTargetClassBody(proxyClassType.addMethod(getInstanceClassMethod)); Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
decoratorMethods(cls, methods); for (Method method : methods) { MethodInformation methodInfo = new RuntimeMethodInformation(method); if (!method.getDeclaringClass().getName().equals("java.lang.Object") || method.getName().equals("toString")) { createDelegateInitializerCode(proxyClassType.addMethod(method), methodInfo, delegateParameterPosition); createAbstractMethodCode(proxyClassType.addMethod(method), methodInfo, staticConstructor); throw new WeldException(e);
@Override protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { super.addSpecialMethods(proxyClassType, staticConstructor); // Add methods for the EnterpriseBeanInstance interface try { proxyClassType.addInterface(EnterpriseBeanInstance.class.getName()); for (Method method : EnterpriseBeanInstance.class.getMethods()) { BeanLogger.LOG.addingMethodToEnterpriseProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); createInterceptorBody(proxyClassType.addMethod(method), methodInfo, staticConstructor); } } catch (Exception e) { throw new WeldException(e); } }
while (cls != null) { Set<MethodSignature> declaredBridgeMethods = new HashSet<MethodSignature>(); for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { && !finalMethods.contains(methodSignature) && !processedBridgeMethods.contains(methodSignature)) { try { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); && !finalMethods.contains(signature) && !processedBridgeMethods.contains(signature)) { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); if (interceptedMethodSignatures.contains(signature) && Reflections.isDefault(method)) { BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); throw new WeldException(e);
private void addMethods(Class<?> cls, ClassFile proxyClassType, ClassMethod staticConstructor) { for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { if (isMethodAccepted(method, getProxySuperclass())) { try { MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); addConstructedGuardToMethodBody(classMethod); createForwardingMethodBody(classMethod, methodInfo, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); } catch (DuplicateMemberException e) { // do nothing. This will happen if superclass methods // have been overridden } } } }
protected void addMethodsFromClass(ClassFile proxyClassType, ClassMethod staticConstructor) { try { Class<?> cls = getBeanType(); generateEqualsMethod(proxyClassType); generateHashCodeMethod(proxyClassType); if (isMethodAccepted(method, getProxySuperclass())) { try { MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); if (Reflections.isDefault(method)) { addConstructedGuardToMethodBody(classMethod); createSpecialMethodBody(classMethod, methodInfo, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); } catch (DuplicateMemberException e) { throw new WeldException(e);
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); final ClassMethod classMethod = proxyClassType.addMethod(method); createInterceptorBody(classMethod, methodInfo, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass"); MethodInformation getInstanceMethodInfo = new RuntimeMethodInformation(getInstanceMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceMethod), getInstanceMethodInfo, staticConstructor); MethodInformation getInstanceClassMethodInfo = new RuntimeMethodInformation(getInstanceClassMethod); createInterceptorBody(proxyClassType.addMethod(getInstanceClassMethod), getInstanceClassMethodInfo, staticConstructor); Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
/** * Adds methods requiring special implementations rather than just * delegation. * * @param proxyClassType the Javassist class description for the proxy type */ protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) { try { // Add special methods for interceptors for (Method method : LifecycleMixin.class.getMethods()) { BeanLogger.LOG.addingMethodToProxy(method); MethodInformation methodInfo = new RuntimeMethodInformation(method); createInterceptorBody(proxyClassType.addMethod(method), methodInfo, false, staticConstructor); } Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance"); Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass"); generateGetTargetInstanceBody(proxyClassType.addMethod(getInstanceMethod)); generateGetTargetClassBody(proxyClassType.addMethod(getInstanceClassMethod)); Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class); generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod)); Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler"); generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod)); } catch (Exception e) { throw new WeldException(e); } }
decoratorMethods(cls, methods); for (Method method : methods) { MethodInformation methodInfo = new RuntimeMethodInformation(method); if (!method.getDeclaringClass().getName().equals("java.lang.Object") || method.getName().equals("toString")) { createDelegateInitializerCode(proxyClassType.addMethod(method), methodInfo, delegateParameterPosition); createAbstractMethodCode(proxyClassType.addMethod(method), methodInfo, staticConstructor); throw new WeldException(e);
for (Method method : AccessController.doPrivileged(new GetDeclaredMethodsAction(cls))) { && !finalMethods.contains(methodSignature) && !processedBridgeMethods.contains(methodSignature)) { try { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); BeanLogger.LOG.addingMethodToProxy(method); } else { createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); && !processedBridgeMethods.contains(signature)) { final MethodInformation methodInfo = new RuntimeMethodInformation(method); ClassMethod classMethod = proxyClassType.addMethod(method); createNotInterceptedMethod(classMethod, methodInfo, method, staticConstructor); BeanLogger.LOG.addingMethodToProxy(method); throw new WeldException(e);