Package org.springframework.beans

Examples of org.springframework.beans.SimpleTypeConverter


            && value.getClass().getComponentType().getName().equals("float")) {
      value = ArrayUtils.toObject((float[]) value);
    } else {
      try {
        if (param.getType().equals(ConfigurationParameter.TYPE_STRING)) {
          SimpleTypeConverter converter = new SimpleTypeConverter();
          PropertyEditorUtil.registerUimaFITEditors(converter);
          if (value.getClass().isArray() || value instanceof Collection) {
            value = converter.convertIfNecessary(value, String[].class);
          } else {
            value = converter.convertIfNecessary(value, String.class);
          }
        }
      } catch (TypeMismatchException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
      }
View Full Code Here


        @Override
        public boolean supports(ParamMetaData metaData) {
            if (ClassUtils.isPrimitiveOrWrapper(metaData.getParamType())) {
                return true;
            }
            SimpleTypeConverter simpleTypeConverter = SafedTypeConverterFactory
                    .getCurrentConverter();
            return simpleTypeConverter.findCustomEditor(metaData.getParamType(), null) != null
                    || simpleTypeConverter.getDefaultEditor(metaData.getParamType()) != null;
        }
View Full Code Here

                        && !DefValue.NATIVE_DEFAULT.equals(defValudeAnnotation.value())) {
                    toConvert = defValudeAnnotation.value();
                }
            }
            if (toConvert != null) {
                SimpleTypeConverter typeConverter = SafedTypeConverterFactory.getCurrentConverter();
                return typeConverter.convertIfNecessary(toConvert, metaData.getParamType());
            }
            if (metaData.getParamType().isPrimitive()) {
                // 对这最常用的类型做一下if-else判断,其他类型就简单使用converter来做吧
                if (metaData.getParamType() == int.class) {
                    return Integer.valueOf(0);
                } else if (metaData.getParamType() == long.class) {
                    return Long.valueOf(0);
                } else if (metaData.getParamType() == boolean.class) {
                    return Boolean.FALSE;
                } else if (metaData.getParamType() == double.class) {
                    return Double.valueOf(0);
                } else if (metaData.getParamType() == float.class) {
                    return Float.valueOf(0);
                } else {
                    SimpleTypeConverter typeConverter = SafedTypeConverterFactory
                            .getCurrentConverter();
                    return typeConverter.convertIfNecessary("0", metaData.getParamType());
                }
            }
            return null;
        }
View Full Code Here

   */
  protected boolean checkQualifiers(BeanDefinitionHolder bdHolder, Annotation[] annotationsToSearch) {
    if (ObjectUtils.isEmpty(annotationsToSearch)) {
      return true;
    }
    SimpleTypeConverter typeConverter = new SimpleTypeConverter();
    for (Annotation annotation : annotationsToSearch) {
      Class<? extends Annotation> type = annotation.annotationType();
      if (isQualifier(type)) {
        if (!checkQualifier(bdHolder, annotation, typeConverter)) {
          return false;
View Full Code Here

      if (!shouldSkip(db)) {

        for (DependencyDescriptor dependencyDescriptor : getDependencyDescriptor(resolver)) {
          Set<String> autowiredBeanNames = new HashSet<String>();
          resolver.resolveDependency(dependencyDescriptor, dependencyDescriptor.getDependencyType(), bean
              .getElementName(), autowiredBeanNames, new SimpleTypeConverter());

          for (String autowiredBeanName : autowiredBeanNames) {
            AutowireBeanReference ref = new AutowireBeanReference(bean, new RuntimeBeanReference(
                autowiredBeanName));
            if (dependencyDescriptor.getField() != null) {
View Full Code Here

TOP

Related Classes of org.springframework.beans.SimpleTypeConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.