Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.TypedStringValue


    if (pv == null) {
      pvs.addPropertyValue("eventListeners", new ManagedMap());
      pv = pvs.getPropertyValue("eventListeners");
    }
    final Map eventListenersMap = (Map) pv.getValue(); //(comp.eventname, Set(listeners))
    Set listenersSet = (Set) eventListenersMap.get(new TypedStringValue(eventname));
    if (listenersSet == null) {
      listenersSet = new ManagedSet();
      eventListenersMap.put(new TypedStringValue(eventname), listenersSet);
    }
    listenersSet.add(new RuntimeBeanReference(listenerid));
  }
View Full Code Here


            Collection collection = (Collection)value;
            for (Object item : collection) {
                configurePropertyElement(propertyElement, item);
            }
        } else if (value instanceof TypedStringValue) {
            TypedStringValue stringValue = (TypedStringValue)value;
            propertyElement.addValue(stringValue.getValue());
        } else {
            if (value != null) {
                propertyElement.addValue(value.toString());
            }
        }
View Full Code Here

                        String[] listValues = null;
                        List<ConstructorArgumentValues.ValueHolder> conArgs =
                                beanDef.getConstructorArgumentValues().getGenericArgumentValues();
                        for (ConstructorArgumentValues.ValueHolder conArg : conArgs) {
                                if (conArg.getValue() instanceof TypedStringValue) {
                                        TypedStringValue value = (TypedStringValue) conArg.getValue();
                                        if (value.getValue().indexOf(".xml") != -1)
                                                listValues = new String[]{value.getValue()};
                                }
                                if (conArg.getValue() instanceof ManagedList) {
                                        Iterator itml = ((ManagedList)conArg.getValue()).iterator();
                                        StringBuffer values = new StringBuffer();
                                        while (itml.hasNext()) {
                                                TypedStringValue next = (TypedStringValue)itml.next();
                                                if (next.getValue().indexOf(".xml") != -1) {
                                                        values.append(next.getValue());
                                                        values.append("~");
                                                }
                                        }
                                        listValues = (values.toString()).split("~");                                   
                                }
View Full Code Here

            Collection collection = (Collection)value;
            for (Object item : collection) {
                configurePropertyElement(propertyElement, item);
            }
        } else if (value instanceof TypedStringValue) {
            TypedStringValue stringValue = (TypedStringValue)value;
            propertyElement.addValue(stringValue.getValue());
        } else {
            if (value != null) {
                propertyElement.addValue(value.toString());
            }
        }
View Full Code Here

    NodeList childNodes = element.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
      Node node = childNodes.item(i);
      if (node instanceof Element) {
        Element includeElement = (Element) node;
        TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
        valueHolder.setSource(parserContext.extractSource(includeElement));
        includePatterns.add(valueHolder);
      }
    }
    if (!includePatterns.isEmpty()) {
      includePatterns.setSource(parserContext.extractSource(element));
View Full Code Here

      }
      return copy;
    }
    else if (value instanceof TypedStringValue) {
      // Convert value to target type here.
      TypedStringValue typedStringValue = (TypedStringValue) value;
      try {
        Class resolvedTargetType = resolveTargetType(typedStringValue);
        if (resolvedTargetType != null) {
          return this.typeConverter.convertIfNecessary(typedStringValue.getValue(), resolvedTargetType);
        }
        else {
          // No target type specified - no conversion necessary...
          return typedStringValue.getValue();
        }
      }
      catch (Throwable ex) {
        // Improve the message by showing the context.
        throw new BeanCreationException(
View Full Code Here

      RuntimeBeanReference ref = new RuntimeBeanReference(refName);
      ref.setSource(extractSource(ele));
      return ref;
    }
    else if (hasValueAttribute) {
      TypedStringValue valueHolder = new TypedStringValue(ele.getAttribute(VALUE_ATTRIBUTE));
      valueHolder.setSource(extractSource(ele));
      return valueHolder;
    }
    else if (subElement != null) {
      return parsePropertySubElement(subElement, bd);
    }
View Full Code Here

      }
    }
    else if (DomUtils.nodeNameEquals(ele, NULL_ELEMENT)) {
      // It's a distinguished null value. Let's wrap it in a TypedStringValue
      // object in order to preserve the source location.
      TypedStringValue nullHolder = new TypedStringValue(null);
      nullHolder.setSource(extractSource(ele));
      return nullHolder;
    }
    else if (DomUtils.nodeNameEquals(ele, LIST_ELEMENT)) {
      return parseListElement(ele, bd);
    }
View Full Code Here

   */
  protected Object buildTypedStringValue(String value, String targetTypeName, Element ele)
      throws ClassNotFoundException {

    ClassLoader classLoader = this.readerContext.getBeanClassLoader();
    TypedStringValue typedValue = null;
    if (!StringUtils.hasText(targetTypeName)) {
      typedValue = new TypedStringValue(value);
    }
    else if (classLoader != null) {
      Class targetType = ClassUtils.forName(targetTypeName, classLoader);
      typedValue = new TypedStringValue(value, targetType);
    }
    else {
      typedValue = new TypedStringValue(value, targetTypeName);
    }
    typedValue.setSource(extractSource(ele));
    return typedValue;
  }
View Full Code Here

      String key = propEle.getAttribute(KEY_ATTRIBUTE);
      // Trim the text value to avoid unwanted whitespace
      // caused by typical XML formatting.
      String value = DomUtils.getTextValue(propEle).trim();

      TypedStringValue keyHolder = new TypedStringValue(key);
      keyHolder.setSource(extractSource(propEle));
      TypedStringValue valueHolder = new TypedStringValue(value);
      valueHolder.setSource(extractSource(propEle));
      props.put(keyHolder, valueHolder);
    }

    return props;
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.TypedStringValue

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.