protected boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; } }
private boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; }
private boolean isNotOverriden(final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == method.getDeclaringClass(); } }
private InterceptorFactory createInterceptorFactory(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Constructor<?> interceptorClassConstructor) throws DeploymentUnitProcessingException { if (methodIdentifier == null) { return null; } final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, this.interceptorClass, deploymentReflectionIndex)) { return this.createInterceptorFactoryForContainerInterceptor(method, interceptorClassConstructor); } return null; }
private void handleInterceptorClass(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Map<String, List<InterceptorFactory>> classMap, final boolean changeMethod, final boolean lifecycleMethod) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, interceptorClass, deploymentReflectionIndex)) { final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(contextKey, method, changeMethod, lifecycleMethod)); List<InterceptorFactory> factories = classMap.get(interceptorClassName); if (factories == null) { classMap.put(interceptorClassName, factories = new ArrayList<InterceptorFactory>()); } factories.add(interceptorFactory); } } } }.run();
private void handleClassMethod(final Class<?> clazz, final MethodIdentifier methodIdentifier, final List<InterceptorFactory> interceptors, boolean changeMethod, boolean lifecycleMethod, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, configuration.getComponentClass(), deploymentReflectionIndex)) { InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(BasicComponentInstance.INSTANCE_KEY, method, changeMethod, lifecycleMethod)); interceptors.add(interceptorFactory); if(lifecycleMethod) { configuration.addLifecycleMethod(method); } } } } }.run();
builder.setAroundInvoke(methodIdentifier); if (aroundInvoke.getClassName() == null || aroundInvoke.getClassName().isEmpty()) { final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName(); component.addInterceptorMethodOverride(className, builder.build()); } else { builder.setPostConstruct(methodIdentifier); if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) { final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName(); component.addInterceptorMethodOverride(className, builder.build()); } else { builder.setPreDestroy(methodIdentifier); if (preDestroy.getClassName() == null || preDestroy.getClassName().isEmpty()) { final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName(); component.addInterceptorMethodOverride(className, builder.build()); } else { builder.setPrePassivate(methodIdentifier); if (prePassivate.getClassName() == null || prePassivate.getClassName().isEmpty()) { final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName(); component.addInterceptorMethodOverride(className, builder.build()); } else { builder.setPostActivate(methodIdentifier); if (postActivate.getClassName() == null || postActivate.getClassName().isEmpty()) { final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName(); component.addInterceptorMethodOverride(className, builder.build()); } else {
private boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; } }
protected boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; } }
protected boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; } }
private boolean isNotOverriden(final Class<?> clazz, final Method method, final Class<?> actualClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException { return Modifier.isPrivate(method.getModifiers()) || ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, actualClass, method).getDeclaringClass() == clazz; }
private void handleInterceptorClass(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Map<String, List<InterceptorFactory>> classMap, final boolean changeMethod, final boolean lifecycleMethod) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, interceptorClass.getModuleClass(), deploymentReflectionIndex)) { final InterceptorFactory interceptorFactory = new ManagedReferenceLifecycleMethodInterceptorFactory(contextKey, method, changeMethod, lifecycleMethod); List<InterceptorFactory> factories = classMap.get(interceptorClassName); if (factories == null) { classMap.put(interceptorClassName, factories = new ArrayList<InterceptorFactory>()); } factories.add(interceptorFactory); } } } }.run();
private void handleClassMethod(final Class<?> clazz, final MethodIdentifier methodIdentifier, final List<InterceptorFactory> interceptors, boolean changeMethod, boolean lifecycleMethod) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, componentClassIndex.getIndexedClass(), deploymentReflectionIndex)) { InterceptorFactory interceptorFactory = new ManagedReferenceLifecycleMethodInterceptorFactory(instanceKey, method, changeMethod, lifecycleMethod); interceptors.add(interceptorFactory); } } } }.run();
private InterceptorFactory createInterceptorFactory(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Constructor<?> interceptorClassConstructor) throws DeploymentUnitProcessingException { if (methodIdentifier == null) { return null; } final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, this.interceptorClass, deploymentReflectionIndex)) { return this.createInterceptorFactoryForContainerInterceptor(method, interceptorClassConstructor); } return null; }
private void handleInterceptorClass(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Map<String, List<InterceptorFactory>> classMap, final boolean changeMethod, final boolean lifecycleMethod) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, interceptorClass, deploymentReflectionIndex)) { final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(contextKey, method, changeMethod, lifecycleMethod)); List<InterceptorFactory> factories = classMap.get(interceptorClassName); if (factories == null) { classMap.put(interceptorClassName, factories = new ArrayList<InterceptorFactory>()); } factories.add(interceptorFactory); } } } }.run();
private void handleInterceptorClass(final Class<?> clazz, final MethodIdentifier methodIdentifier, final Map<String, List<InterceptorFactory>> classMap, final boolean changeMethod, final boolean lifecycleMethod) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, interceptorClass, deploymentReflectionIndex)) { final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(contextKey, method, changeMethod, lifecycleMethod)); List<InterceptorFactory> factories = classMap.get(interceptorClassName); if (factories == null) { classMap.put(interceptorClassName, factories = new ArrayList<InterceptorFactory>()); } factories.add(interceptorFactory); } } } }.run();
/** * Finds and returns a method corresponding to the passed <code>method</code>, which may be declared in the super class * of the passed <code>classReflectionIndex</code>. * <p/> * <p/> * Throws {@link org.jboss.as.server.deployment.DeploymentUnitProcessingException} if no such method is found. * * @param deploymentReflectionIndex The deployment reflection index * @param clazz The class * @param method The method being searched for * @return * @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException * If no such method is found */ public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) throws DeploymentUnitProcessingException { Assert.checkNotNullParam("method", method); final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method); return findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); }
/** * Finds and returns a method corresponding to the passed <code>method</code>, which may be declared in the super class * of the passed <code>classReflectionIndex</code>. * <p/> * <p/> * Throws {@link org.jboss.as.server.deployment.DeploymentUnitProcessingException} if no such method is found. * * @param deploymentReflectionIndex The deployment reflection index * @param clazz The class * @param method The method being searched for * @return * @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException * If no such method is found */ public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) throws DeploymentUnitProcessingException { Assert.checkNotNullParam("method", method); final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method); return findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); }
private void handleClassMethod(final Class<?> clazz, final MethodIdentifier methodIdentifier, final List<InterceptorFactory> interceptors, boolean changeMethod, boolean lifecycleMethod, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, configuration.getComponentClass(), deploymentReflectionIndex)) { InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(BasicComponentInstance.INSTANCE_KEY, method, changeMethod, lifecycleMethod)); interceptors.add(interceptorFactory); if(lifecycleMethod) { configuration.addLifecycleMethod(method); } } } } }.run();
private void handleClassMethod(final Class<?> clazz, final MethodIdentifier methodIdentifier, final List<InterceptorFactory> interceptors, boolean changeMethod, boolean lifecycleMethod, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { if (methodIdentifier != null) { final Method method = ClassReflectionIndexUtil.findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (isNotOverriden(clazz, method, configuration.getComponentClass(), deploymentReflectionIndex)) { InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new ManagedReferenceLifecycleMethodInterceptor(BasicComponentInstance.INSTANCE_KEY, method, changeMethod, lifecycleMethod)); interceptors.add(interceptorFactory); if(lifecycleMethod) { configuration.addLifecycleMethod(method); } } } } }.run();