private void processMethod(final DeploymentUnit deploymentUnit, final EJBResourceWrapper annotation, final MethodInfo methodInfo, final EEModuleDescription eeModuleDescription) { final String methodName = methodInfo.name(); if (!methodName.startsWith("set") || methodInfo.args().length != 1) { throw EjbLogger.ROOT_LOGGER.onlySetterMethodsAllowedToHaveEJBAnnotation(methodInfo); } final String methodParamType = methodInfo.args()[0].name().toString(); final InjectionTarget targetDescription = new MethodInjectionTarget(methodInfo.declaringClass().name().toString(), methodName, methodParamType); final String localContextName = isEmpty(annotation.name()) ? methodInfo.declaringClass().name().toString() + "/" + methodName.substring(3, 4).toLowerCase(Locale.ENGLISH) + methodName.substring(4) : annotation.name(); final String beanInterfaceType = isEmpty(annotation.beanInterface()) || annotation.beanInterface().equals(Object.class.getName()) ? methodParamType : annotation.beanInterface(); process(deploymentUnit, beanInterfaceType, annotation.beanName(), annotation.lookup(), methodInfo.declaringClass(), targetDescription, localContextName, eeModuleDescription); }
public Method getMethod(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final String name = getName(); final String className = getClassName(); final String paramType = getDeclaredValueClassName(); final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); final Class<?> clazz; try { clazz = ClassLoadingUtils.loadClass(className, deploymentUnit); } catch (ClassNotFoundException e) { throw new DeploymentUnitProcessingException(e); } Method method = getMethod(reflectionIndex, clazz); return method; }
public Method getMethod(final DeploymentReflectionIndex reflectionIndex, final Class<?> clazz) throws DeploymentUnitProcessingException { final ClassReflectionIndex classIndex = reflectionIndex.getClassIndex(clazz); Collection<Method> methods = null; final String paramType = getDeclaredValueClassName(); final String name = getName(); final String className = getClassName(); if (paramType != null) { // find the methods with the specific name and the param types methods = ClassReflectionIndexUtil.findMethods(reflectionIndex, classIndex, name, paramType); } // either paramType is not set, or we may need to find autoboxing methods // e.g. setMyBoolean(boolean) for a Boolean if (methods == null || methods.isEmpty()) { // find all the methods with the specific name and which accept just 1 parameter. methods = ClassReflectionIndexUtil.findAllMethods(reflectionIndex, classIndex, name, 1); } Iterator<Method> iterator = methods.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.methodNotFound(name, paramType, className); } Method method = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleMethodsFound(name, paramType, className); } return method; } }
@Override public boolean isStatic(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { return Modifier.isStatic(getMethod(deploymentUnit).getModifiers()); }
public Method getMethod(final DeploymentReflectionIndex reflectionIndex, final Class<?> clazz) throws DeploymentUnitProcessingException { final ClassReflectionIndex classIndex = reflectionIndex.getClassIndex(clazz); Collection<Method> methods = null; final String paramType = getDeclaredValueClassName(); final String name = getName(); final String className = getClassName(); if (paramType != null) { // find the methods with the specific name and the param types methods = ClassReflectionIndexUtil.findMethods(reflectionIndex, classIndex, name, paramType); } // either paramType is not set, or we may need to find autoboxing methods // e.g. setMyBoolean(boolean) for a Boolean if (methods == null || methods.isEmpty()) { // find all the methods with the specific name and which accept just 1 parameter. methods = ClassReflectionIndexUtil.findAllMethods(reflectionIndex, classIndex, name, 1); } Iterator<Method> iterator = methods.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.methodNotFound(name, paramType, className); } Method method = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleMethodsFound(name, paramType, className); } return method; } }
public InterceptorFactory createInjectionInterceptorFactory(final Object targetContextKey, final Object valueContextKey, final Value<ManagedReferenceFactory> factoryValue, final DeploymentUnit deploymentUnit, final boolean optional) throws DeploymentUnitProcessingException { return new ManagedReferenceMethodInjectionInterceptorFactory(targetContextKey, valueContextKey, factoryValue, getMethod(deploymentUnit), optional); }
new MethodInjectionTarget(injectionTargetClassName, memberName, classType.getName());
public Method getMethod(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final String name = getName(); final String className = getClassName(); final String paramType = getDeclaredValueClassName(); final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); final Class<?> clazz; try { clazz = ClassLoadingUtils.loadClass(className, deploymentUnit); } catch (ClassNotFoundException e) { throw new DeploymentUnitProcessingException(e); } Method method = getMethod(reflectionIndex, clazz); return method; }
public Method getMethod(final DeploymentReflectionIndex reflectionIndex, final Class<?> clazz) throws DeploymentUnitProcessingException { final ClassReflectionIndex classIndex = reflectionIndex.getClassIndex(clazz); Collection<Method> methods = null; final String paramType = getDeclaredValueClassName(); final String name = getName(); final String className = getClassName(); if (paramType != null) { // find the methods with the specific name and the param types methods = ClassReflectionIndexUtil.findMethods(reflectionIndex, classIndex, name, paramType); } // either paramType is not set, or we may need to find autoboxing methods // e.g. setMyBoolean(boolean) for a Boolean if (methods == null || methods.isEmpty()) { // find all the methods with the specific name and which accept just 1 parameter. methods = ClassReflectionIndexUtil.findAllMethods(reflectionIndex, classIndex, name, 1); } Iterator<Method> iterator = methods.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.methodNotFound(name, paramType, className); } Method method = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleMethodsFound(name, paramType, className); } return method; } }
Method method = mt.getMethod(deploymentReflectionIndex, clazz); if(!isNotOverriden(clazz, method, actualClass, deploymentReflectionIndex)) { continue;
protected void processMethodResource(final DeploymentPhaseContext phaseContext, final MethodInfo methodInfo, final String name, final String type, final EEModuleClassDescription classDescription, final AnnotationInstance annotation, final EEModuleDescription eeModuleDescription, final Module module, final EEApplicationClasses applicationClasses, final PropertyReplacer replacer) throws DeploymentUnitProcessingException { final String methodName = methodInfo.name(); if (!methodName.startsWith("set") || methodInfo.args().length != 1) { throw EeLogger.ROOT_LOGGER.setterMethodOnly("@Resource", methodInfo); } final String contextNameSuffix = methodName.substring(3, 4).toLowerCase(Locale.ENGLISH) + methodName.substring(4); final String localContextName = isEmpty(name) ? methodInfo.declaringClass().name().toString() + "/" + contextNameSuffix : name; final String injectionType = isEmpty(type) || type.equals(Object.class.getName()) ? methodInfo.args()[0].name().toString() : type; final InjectionTarget targetDescription = new MethodInjectionTarget(methodInfo.declaringClass().name().toString(), methodName, methodInfo.args()[0].name().toString()); process(phaseContext, classDescription, annotation, injectionType, localContextName, targetDescription, eeModuleDescription, module, applicationClasses, replacer); }
public Method getMethod(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final String name = getName(); final String className = getClassName(); final String paramType = getDeclaredValueClassName(); final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); final Class<?> clazz; try { clazz = ClassLoadingUtils.loadClass(className, deploymentUnit); } catch (ClassNotFoundException e) { throw new DeploymentUnitProcessingException(e); } Method method = getMethod(reflectionIndex, clazz); return method; }
private Method getMethod(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final String name = getName(); final String className = getClassName(); final String paramType = getDeclaredValueClassName(); final Module module = deploymentUnit.getAttachment(MODULE); final ModuleClassLoader classLoader = module.getClassLoader();
@Override public boolean isStatic(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { return Modifier.isStatic(getMethod(deploymentUnit).getModifiers()); }
new MethodInjectionTarget(injectionTargetClassName, memberName, classType.getName());
@Override public boolean isStatic(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { return Modifier.isStatic(getMethod(deploymentUnit).getModifiers()); }
new MethodInjectionTarget(injectionTargetClassName, memberName, classType.getName());
@Override public boolean isStatic(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { return Modifier.isStatic(getMethod(deploymentUnit).getModifiers()); }
new MethodInjectionTarget(injectionTargetClassName, memberName, classType.getName());
public InterceptorFactory createInjectionInterceptorFactory(final Object targetContextKey, final Object valueContextKey, final Value<ManagedReferenceFactory> factoryValue, final DeploymentUnit deploymentUnit, final boolean optional) throws DeploymentUnitProcessingException { return new ManagedReferenceMethodInjectionInterceptorFactory(targetContextKey, valueContextKey, factoryValue, getMethod(deploymentUnit), optional); }