/** * Gets a signature entry for a given method. * @param methodMetadata the metadata used to extract signature * @return a signature string */ public static String getSignature(final ICommonMethodMetadata<?, ?, ?> methodMetadata) { return methodMetadata.getJMethod().getName() + methodMetadata.getJMethod().getDescriptor().hashCode(); }
/** * @param access access of method (public, ...) * @param name name of method * @param desc desc * @param signature signature of method * @param exceptions throwed exceptions * @return a visitor */ @Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { JMethod jMethod = new JMethod(access, name, desc, signature, exceptions); List<IMethodConfigurator> methodConfigurators = new ArrayList<IMethodConfigurator>(); for (IClassConfigurator classConfigurator : getConfigurators()) { methodConfigurators.add(classConfigurator.createMethodConfigurator(jMethod)); } return new ScanMethodVisitor(methodConfigurators, referencedClasses); }
JMethod otherMethod = new JMethod(Opcodes.ACC_PUBLIC, jMethod.getName() + compareMetaData.getClassName().replace("/", ""), jMethod.getDescriptor(), jMethod .getSignature(), jMethod.getExceptions()); if (!methodMetadata.getJMethod().equals(method.getJMethod()) && !methodMetadata.getJMethod().equals(otherMethod)) { throw new InterceptorsValidationException("Class " + getClassName() + " has already a " + itcType + " method which is " + method.getMethodName() + ", cannot set new method "
/** * Override because * {@link org.ow2.easybeans.enhancer.interceptors.InterceptorClassAdapter} * use it. * @return the method name */ @Override public String getMethodName() { return getJMethod().getName(); }
Type[] args = Type.getArgumentTypes(jMethod.getDescriptor()); if (args.length != 1) { throw new ENCBindingException("Method args '" + Arrays.asList(args) + "' for method '" + jMethod
/** * Add a @{@link javax.interceptor.AroundInvoke} method of this class. * @param aroundInvokeMethodMetadata the method. */ public void addAroundInvokeMethodMetadata(final EasyBeansEjbJarMethodMetadata aroundInvokeMethodMetadata) { if (this.aroundInvokeMethodsMetadata == null) { this.aroundInvokeMethodsMetadata = new LinkedList<EasyBeansEjbJarMethodMetadata>(); } // Check not yet present for (EasyBeansEjbJarMethodMetadata methodMetadata : this.aroundInvokeMethodsMetadata) { if (aroundInvokeMethodMetadata.getClassMetadata().getClassName().equals(methodMetadata.getClassMetadata().getClassName())) { if (aroundInvokeMethodMetadata.getJMethod().equals(methodMetadata.getJMethod())) { return; } } } this.aroundInvokeMethodsMetadata.addFirst(aroundInvokeMethodMetadata); }
/** * {@inheritDoc} */ public List<? extends SM> searchSpecificMethodMetadata(final String methodName) { if (methodName == null) { throw new IllegalArgumentException("Cannot search null methods"); } List<SM> list = new ArrayList<SM>(); for (SM method : methodsAnnotationMetadata.values()) { if (methodName.equals(method.getJMethod().getName())) { list.add(method); } } return list; }
Type[] args = Type.getArgumentTypes(jMethod.getDescriptor()); if (args.length != 1) { throw new ENCBindingException("Method args '" + Arrays.asList(args) + "' for method '" + jMethod
/** * Gets a signature entry for a given method. * @param methodMetadata the metadata used to extract signature * @return a signature string */ public static String getSignature(final ICommonMethodMetadata<?, ?, ?> methodMetadata) { return methodMetadata.getJMethod().getName() + methodMetadata.getJMethod().getDescriptor().hashCode(); }
/** * @param methodName the name of the method to search * @return list of method annotation metadata for the given method name */ public final List<M> searchStandardMethodMetadata(final String methodName) { if (methodName == null) { throw new IllegalArgumentException("Cannot search null methods"); } List<M> list = new ArrayList<M>(); for (M method : methodsAnnotationMetadata.values()) { if (methodName.equals(method.getJMethod().getName())) { list.add(method); } } return list; }
String type = getMethodParamClassname(methodMetadata.getJMethod().getDescriptor(), 0); webServiceRef.setType(type);
/** * @param access access of method (public, ...) * @param name name of method * @param desc desc * @param signature signature of method * @param exceptions throwed exceptions * @return a visitor */ @Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { JMethod jMethod = new JMethod(access, name, desc, signature, exceptions); List<IMethodConfigurator> methodConfigurators = new ArrayList<IMethodConfigurator>(); for (IClassConfigurator classConfigurator : getConfigurators()) { methodConfigurators.add(classConfigurator.createMethodConfigurator(jMethod)); } return new ScanMethodVisitor(methodConfigurators, referencedClasses); }
String methodName = jMethod.getName(); Type[] argumentTypes = Type.getArgumentTypes(jMethod.getDescriptor());
/** * Gets the ENC name for the given metadata. * @param commonMetadata the metadata to analyze. * @param o the given object associated to the metadata (used for logging). * @return the given ENC name * @throws ENCBindingException if no name has been defined on the given name * and the metadata is invalid. */ private String getName(final ISharedMetadata commonMetadata, final Object o) throws ENCBindingException { if (commonMetadata instanceof CommonFieldMetadata) { CommonFieldMetadata<?, ?, ?> fieldAnnotationMetadata = (CommonFieldMetadata<?, ?, ?>) commonMetadata; return fieldAnnotationMetadata.getClassMetadata().getJClass().getName().replace("/", ".") + "/" + fieldAnnotationMetadata.getJField().getName(); } if (commonMetadata instanceof CommonMethodMetadata) { CommonMethodMetadata<?, ?, ?> methodAnnotationMetadata = (CommonMethodMetadata<?, ?, ?>) commonMetadata; StringBuilder propertyBuilder = new StringBuilder(methodAnnotationMetadata.getJMethod().getName()); propertyBuilder.delete(0, GETTER_LENGTH); propertyBuilder.setCharAt(0, Character.toLowerCase(propertyBuilder.charAt(0))); propertyBuilder.insert(0, methodAnnotationMetadata.getClassMetadata().getJClass().getName().replace("/", ".") + "/"); return propertyBuilder.toString(); } // Last case is the Class case. throw new ENCBindingException("There is no defined name in the object '" + o + "' that is defined on the class '" + commonMetadata + "'."); }
String methodName = jMethod.getName(); Type[] argumentTypes = Type.getArgumentTypes(jMethod.getDescriptor());
/** * Gets the ENC name for the given metadata. * @param commonMetadata the metadata to analyze. * @param o the given object associated to the metadata (used for logging). * @return the given ENC name * @throws ENCBindingException if no name has been defined on the given name * and the metadata is invalid. */ private String getName(final ISharedMetadata commonMetadata, final Object o) throws ENCBindingException { if (commonMetadata instanceof CommonFieldMetadata) { CommonFieldMetadata<?, ?, ?> fieldAnnotationMetadata = (CommonFieldMetadata<?, ?, ?>) commonMetadata; return fieldAnnotationMetadata.getClassMetadata().getJClass().getName().replace("/", ".") + "/" + fieldAnnotationMetadata.getJField().getName(); } if (commonMetadata instanceof CommonMethodMetadata) { CommonMethodMetadata<?, ?, ?> methodAnnotationMetadata = (CommonMethodMetadata<?, ?, ?>) commonMetadata; StringBuilder propertyBuilder = new StringBuilder(methodAnnotationMetadata.getJMethod().getName()); propertyBuilder.delete(0, GETTER_LENGTH); propertyBuilder.setCharAt(0, Character.toLowerCase(propertyBuilder.charAt(0))); propertyBuilder.insert(0, methodAnnotationMetadata.getClassMetadata().getJClass().getName().replace("/", ".") + "/"); return propertyBuilder.toString(); } // Last case is the Class case. throw new ENCBindingException("There is no defined name in the object '" + o + "' that is defined on the class '" + commonMetadata + "'."); }
String methodName = methodMetadata.getJMethod().getName(); methodName = methodName.substring("set".length()); String first = methodName.substring(0, 1).toUpperCase();
/** * Add the given ENC name for the given field or method. * @param encName the name of the ENC value * @param commonMetadata the field or method or null object */ protected void addFieldOrMethodENC(final String encName, final ISharedMetadata commonMetadata) { // Don't do anything if there is no field/method if (commonMetadata == null) { return; } // Add ENC injection target if (commonMetadata instanceof CommonFieldMetadata) { CommonFieldMetadata<?, ?, ?> fieldAnnotationMetadata = (CommonFieldMetadata<?, ?, ?>) commonMetadata; String fieldName = fieldAnnotationMetadata.getJField().getName(); this.bindingHolder.addFieldInjectionTarget(fieldAnnotationMetadata.getClassMetadata().getJClass().getName().replace('/', '.'), new InjectionTargetEncImpl(fieldName, encName)); } else if (commonMetadata instanceof CommonMethodMetadata) { CommonMethodMetadata<?, ?, ?> methodAnnotationMetadata = (CommonMethodMetadata<?, ?, ?>) commonMetadata; String methodName = methodAnnotationMetadata.getJMethod().getName(); this.bindingHolder.addMethodInjectionTarget(methodAnnotationMetadata.getClassMetadata().getJClass().getName().replace('/', '.'), new InjectionTargetEncImpl(methodName, encName)); } }
/** * Add the given ENC name for the given field or method. * @param encName the name of the ENC value * @param commonMetadata the field or method or null object */ protected void addFieldOrMethodENC(final String encName, final ISharedMetadata commonMetadata) { // Don't do anything if there is no field/method if (commonMetadata == null) { return; } // Add ENC injection target if (commonMetadata instanceof CommonFieldMetadata) { CommonFieldMetadata<?, ?, ?> fieldAnnotationMetadata = (CommonFieldMetadata<?, ?, ?>) commonMetadata; String fieldName = fieldAnnotationMetadata.getJField().getName(); this.bindingHolder.addFieldInjectionTarget(fieldAnnotationMetadata.getClassMetadata().getJClass().getName().replace('/', '.'), new InjectionTargetEncImpl(fieldName, encName)); } else if (commonMetadata instanceof CommonMethodMetadata) { CommonMethodMetadata<?, ?, ?> methodAnnotationMetadata = (CommonMethodMetadata<?, ?, ?>) commonMetadata; String methodName = methodAnnotationMetadata.getJMethod().getName(); this.bindingHolder.addMethodInjectionTarget(methodAnnotationMetadata.getClassMetadata().getJClass().getName().replace('/', '.'), new InjectionTargetEncImpl(methodName, encName)); } }