/** * Override because * {@link org.ow2.easybeans.enhancer.interceptors.InterceptorClassAdapter} * use it. * @return the method name */ @Override public String getMethodName() { return getJMethod().getName(); }
/** * {@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; }
/** * @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; }
/** * 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(); }
/** * 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(); }
String methodName = jMethod.getName();
String methodName = jMethod.getName();
/** * 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 + "'."); }
/** * 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)); } }
JMethod otherMethod = new JMethod(Opcodes.ACC_PUBLIC, jMethod.getName() + compareMetaData.getClassName().replace("/", ""), jMethod.getDescriptor(), jMethod .getSignature(), jMethod.getExceptions());