/** * {@inheritDoc} */ public List<? extends SF> searchSpecificFieldMetadata(final String fieldName) { if (fieldName == null) { throw new IllegalArgumentException("Cannot search null fields"); } List<SF> list = new ArrayList<SF>(); for (SF field : fieldsAnnotationMetadata.values()) { if (fieldName.equals(field.getJField().getName())) { list.add(field); } } return list; }
/** * @param access access of field (public, ...) * @param name name of field * @param desc desc * @param signature signature of field * @param value value of field * @return a visitor */ @Override public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { JField jField = new JField(access, name, desc, signature, value); List<IFieldConfigurator> fieldConfigurators = new ArrayList<IFieldConfigurator>(); for (IClassConfigurator classConfigurator : getConfigurators()) { fieldConfigurators.add(classConfigurator.createFieldConfigurator(jField)); } return new ScanFieldVisitor(fieldConfigurators, referencedClasses); }
Type typeInterface = Type.getType(fieldAnnotationMetadata.getJField().getDescriptor()); return typeInterface.getClassName(); } else if (commonMetadata instanceof CommonMethodMetadata) {
Type typeInterface = Type.getType(fieldAnnotationMetadata.getJField().getDescriptor()); return typeInterface.getClassName(); } else if (commonMetadata instanceof CommonMethodMetadata) {
/** * @param fieldName the name of the field to search * @return list of field annotation metadata for the given field name */ public final List<F> searchStandardFieldMetadata(final String fieldName) { if (fieldName == null) { throw new IllegalArgumentException("Cannot search null fields"); } List<F> list = new ArrayList<F>(); for (F field : fieldsAnnotationMetadata.values()) { if (fieldName.equals(field.getJField().getName())) { list.add(field); } } return list; }
String type = getClassname(fieldMetadata.getJField().getDescriptor()); webServiceRef.setType(type);
/** * @param access access of field (public, ...) * @param name name of field * @param desc desc * @param signature signature of field * @param value value of field * @return a visitor */ @Override public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { JField jField = new JField(access, name, desc, signature, value); List<IFieldConfigurator> fieldConfigurators = new ArrayList<IFieldConfigurator>(); for (IClassConfigurator classConfigurator : getConfigurators()) { fieldConfigurators.add(classConfigurator.createFieldConfigurator(jField)); } return new ScanFieldVisitor(fieldConfigurators, referencedClasses); }
/** * 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 + "'."); }
/** * 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)); } }