Examples of TypedStringValue


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

                                        .getGenericArgumentValues();
                                   
                                    ConstructorArgumentValues.ValueHolder v
                                        = (ConstructorArgumentValues.ValueHolder)l.get(0);
                                   
                                    TypedStringValue nss = (TypedStringValue)v.getValue();
                                    v = (ConstructorArgumentValues.ValueHolder)l.get(1);
                                    TypedStringValue ln = (TypedStringValue)v.getValue();
                                    checked.add(new QName(nss.getValue(), ln.getValue()));
                                } catch (Exception ex) {
                                    //ignore
                                    break;
                                }
                            } else {
View Full Code Here

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

        GenericBeanDefinition definition = new GenericBeanDefinition();
        definition.setBeanClass(GwtServiceBeanFactoryPostProcessor.class);

        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.addPropertyValue("pathPrefix", new TypedStringValue(pathPrefix));

        Element mappingsElement = DomUtils.getChildElementByTagName(element, UNEXPECTED_EXCEPTION_MAPPTINS_DEF);

        if (mappingsElement != null) {

            ManagedList<RootBeanDefinition> mappingList = new ManagedList<RootBeanDefinition>();
            for (Element mappingElement : DomUtils.getChildElementsByTagName(mappingsElement, MAPPING_DEF)) {
                BeanDefinitionBuilder mappingBuilder = BeanDefinitionBuilder.rootBeanDefinition(UnexpectedExceptionMapping.class);
                String throwableClassName = mappingElement.getAttribute(THROWABLE_CLASS_ATTR);
                String statusCode = mappingElement.getAttribute(STATUS_CODE_ATTR);
                String message = mappingElement.getAttribute(MESSAGE_ATTR);
                mappingBuilder.addConstructorArgValue(throwableClassName);
                mappingBuilder.addConstructorArgValue(statusCode);
                mappingBuilder.addConstructorArgValue(message);
                mappingList.add((RootBeanDefinition) mappingBuilder.getBeanDefinition());
            }

            BeanDefinitionBuilder mappingsBuilder = BeanDefinitionBuilder.rootBeanDefinition(UnexpectedExceptionMappings.class);
            mappingsBuilder.addConstructorArgValue(mappingList);
            RootBeanDefinition mappingsBeanDefinition = (RootBeanDefinition) mappingsBuilder.getBeanDefinition();
            String id = parserContext.getReaderContext().registerWithGeneratedName(mappingsBeanDefinition);

            logger.info("Registered UnexpectedExceptionMappgins bean with id '" + id + "'");

            propertyValues.addPropertyValue("unexpectedExceptionMappingsBeanName", new TypedStringValue(id));

        }

        definition.setPropertyValues(propertyValues);
View Full Code Here

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

        if (connectionsElem != null) {
            Map connections = ctx.getDelegate().parseMapElement(connectionsElem, null);
            servletFactoryDefBuilder.addPropertyValue("connections", connections);
            Map connectionNames = new HashMap();
            for (Iterator it = connections.keySet().iterator(); it.hasNext();) {
                TypedStringValue key = (TypedStringValue) it.next();
                if (key.getValue().endsWith("+")) {
                    throw new InvalidBeanReferenceNameException(
                                    "The key of a servlet connection mustn't use '+' as its last character. "
                                                    + "This is reserved for absolute references in servlet sources.");
                }
                RuntimeBeanReference beanNameReference = (RuntimeBeanReference) connections.get(key);
                connectionNames.put(key.getValue(), beanNameReference.getBeanName());
            }
            servletFactoryDefBuilder.addPropertyValue("connectionServiceNames", connectionNames);
        }

        return new BeanDefinitionHolder(servletFactoryDefBuilder.getBeanDefinition(), holder.getBeanName());
View Full Code Here

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

  public void testBeanEventReceived() throws Exception {
    ComponentDefinition componentDefinition1 = this.eventListener.getComponentDefinition("testBean");
    assertTrue(componentDefinition1 instanceof BeanComponentDefinition);
    assertEquals(1, componentDefinition1.getBeanDefinitions().length);
    BeanDefinition beanDefinition1 = componentDefinition1.getBeanDefinitions()[0];
    assertEquals(new TypedStringValue("Rob Harrop"),
        beanDefinition1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
    assertEquals(1, componentDefinition1.getBeanReferences().length);
    assertEquals("testBean2", componentDefinition1.getBeanReferences()[0].getBeanName());
    assertEquals(1, componentDefinition1.getInnerBeanDefinitions().length);
    BeanDefinition innerBd1 = componentDefinition1.getInnerBeanDefinitions()[0];
    assertEquals(new TypedStringValue("ACME"),
        innerBd1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
    assertTrue(componentDefinition1.getSource() instanceof Element);

    ComponentDefinition componentDefinition2 = this.eventListener.getComponentDefinition("testBean2");
    assertTrue(componentDefinition2 instanceof BeanComponentDefinition);
    assertEquals(1, componentDefinition1.getBeanDefinitions().length);
    BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
    assertEquals(new TypedStringValue("Juergen Hoeller"),
        beanDefinition2.getPropertyValues().getPropertyValue("name").getValue());
    assertEquals(0, componentDefinition2.getBeanReferences().length);
    assertEquals(1, componentDefinition2.getInnerBeanDefinitions().length);
    BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
    assertEquals(new TypedStringValue("Eva Schallmeiner"),
        innerBd2.getPropertyValues().getPropertyValue("name").getValue());
    assertTrue(componentDefinition2.getSource() instanceof Element);
  }
View Full Code Here

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

      }
      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

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

      }
      return copy;
    }
    else if (value instanceof TypedStringValue) {
      // Convert value to target type here.
      TypedStringValue typedStringValue = (TypedStringValue) value;
      Object valueObject = evaluate(typedStringValue);
      try {
        Class<?> resolvedTargetType = resolveTargetType(typedStringValue);
        if (resolvedTargetType != null) {
          return this.typeConverter.convertIfNecessary(valueObject, resolvedTargetType);
View Full Code Here

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

      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

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

      return parseValueElement(ele, defaultValueType);
    }
    else if (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 (nodeNameEquals(ele, ARRAY_ELEMENT)) {
      return parseArrayElement(ele, bd);
    }
View Full Code Here

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

    String typeName = specifiedTypeName;
    if (!StringUtils.hasText(typeName)) {
      typeName = defaultTypeName;
    }
    try {
      TypedStringValue typedValue = buildTypedStringValue(value, typeName);
      typedValue.setSource(extractSource(ele));
      typedValue.setSpecifiedTypeName(specifiedTypeName);
      return typedValue;
    }
    catch (ClassNotFoundException ex) {
      error("Type class [" + typeName + "] not found for <value> element", ele, ex);
      return value;
View Full Code Here

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

   */
  protected TypedStringValue buildTypedStringValue(String value, String targetTypeName)
      throws ClassNotFoundException {

    ClassLoader classLoader = this.readerContext.getBeanClassLoader();
    TypedStringValue typedValue;
    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);
    }
    return typedValue;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.