Package org.springframework.beans

Examples of org.springframework.beans.PropertyValue


      try {
        Class<?> beanClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
        if (FactoryBean.class.isAssignableFrom(beanClass)) {
          register(beanClass, "&" + name);
          PropertyValue pv = bd.getPropertyValues().getPropertyValue("target");
          if (null == pv) {
            Class<?> artifactClass = ((FactoryBean<?>) beanClass.newInstance()).getObjectType();
            if (null != artifactClass) register(artifactClass, name);
          } else {
            if (pv.getValue() instanceof BeanDefinitionHolder) {
              String nestedClassName = ((BeanDefinitionHolder) pv.getValue())
                  .getBeanDefinition().getBeanClassName();
              if (null != nestedClassName) {
                register(
                    ClassUtils.forName(nestedClassName,
                        ClassUtils.getDefaultClassLoader()), name);
View Full Code Here


      @SuppressWarnings("unchecked")
      Enumeration<String> en = config.getInitParameterNames();
      while (en.hasMoreElements()) {
        String property = en.nextElement();
        Object value = config.getInitParameter(property);
        addPropertyValue(new PropertyValue(property, value));
        if (missingProps != null) {
          missingProps.remove(property);
        }
      }
View Full Code Here

      if (bd.getPropertyValues().contains(propertyName)) {
        error("Multiple 'property' definitions for property '" + propertyName + "'", ele);
        return;
      }
      Object val = parsePropertyValue(ele, bd, propertyName);
      PropertyValue pv = new PropertyValue(propertyName, val);
      parseMetaElements(ele, pv);
      pv.setSource(extractSource(ele));
      bd.getPropertyValues().addPropertyValue(pv);
    } finally {
      this.parseState.pop();
    }
  }
View Full Code Here

                continue;
            }

            try {
                Collection<?> ids = null;
                PropertyValue pv = def.getPropertyValues().getPropertyValue(idsProperty);
               
                if (pv != null) {
                    Object value = pv.getValue();
                    if (!(value instanceof Collection)) {
                        throw new RuntimeException("The property " + idsProperty + " must be a collection!");
                    }

                    if (value instanceof Mergeable) {
View Full Code Here

    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) {
        if (configurableListableBeanFactory.containsBean(validatorFactoryBeanName)) {
            BeanDefinition validatorFactoryBeanDefinition =
                    configurableListableBeanFactory.getBeanDefinition(validatorFactoryBeanName);
            MutablePropertyValues propertyValues = validatorFactoryBeanDefinition.getPropertyValues();
            PropertyValue propertyValue = propertyValues.getPropertyValue("validationConfigLocations");

            //value is expected to be a list.
            List existingValidationConfigLocations = (List) propertyValue.getValue();
            existingValidationConfigLocations.addAll(validationConfigLocations);
        }
    }
View Full Code Here

    if (null == context || !REPOSITORY_TYPE.isAssignableFrom(beanClass)) {
      return null;
    }

    BeanDefinition definition = context.getBeanDefinition(beanName);
    PropertyValue value = definition.getPropertyValues().getPropertyValue("repositoryInterface");

    Class<?> resolvedBeanClass = cache.get(beanName);

    if (cache.containsKey(beanName)) {
      return cache.get(beanName);
View Full Code Here

    {
        if(registrationPropertyValues == null)
        {
            return null;
        }
        PropertyValue propertyValue = registrationPropertyValues.getPropertyValue(propertyName);
        if(propertyValue == null)
        {
            return null;
        }
        Object value = propertyValue.getValue();
        if(value == null)
        {
            return null;
        }
        if(value.getClass() == String.class)
View Full Code Here

    @Test
    public void testFeatureServiceFactoryProperties() {
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNotNull(contextProvidersProperty);
        assertTrue(contextProvidersProperty.getValue() instanceof List);
        List contextProvidersList = ((List)contextProvidersProperty.getValue());
        assertEquals(2, contextProvidersList.size());
       
        assertTrue(contextProvidersList.get(0) instanceof BeanDefinitionHolder);
        assertEquals(SystemPropertiesContextProvider.class.getName(), ((BeanDefinitionHolder)contextProvidersList.get(0)).getBeanDefinition().getBeanClassName());
       
        assertTrue(contextProvidersList.get(1) instanceof BeanReference);
        assertEquals("contextProviderBean", ((BeanReference)contextProvidersList.get(1)).getBeanName());

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNotNull(propertyReadersProperty);
        assertTrue(propertyReadersProperty.getValue() instanceof List);
        List propertyReadersList = ((List)propertyReadersProperty.getValue());
        assertEquals(2, propertyReadersList.size());
       
        assertTrue(propertyReadersList.get(0) instanceof BeanDefinitionHolder);
        assertEquals(XmlPropertyReader.class.getName(), ((BeanDefinitionHolder)propertyReadersList.get(0)).getBeanDefinition().getBeanClassName());
       
        assertTrue(propertyReadersList.get(1) instanceof BeanReference);
        assertEquals("propertyReaderBean", ((BeanReference)propertyReadersList.get(1)).getBeanName());
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNotNull(propertiesProperty);
        assertTrue(propertiesProperty.getValue() instanceof Properties);
        Properties properties = ((Properties)propertiesProperty.getValue());
        assertEquals(1, properties.size());
       
        for(Map.Entry entry : properties.entrySet()) {
            assertEquals("aa", ((TypedStringValue)entry.getKey()).getValue());
            assertEquals("bb", ((TypedStringValue)entry.getValue()).getValue());
View Full Code Here

    public void testFeatureServiceFactoryPropertiesMising() {
        setupContext("test-feature-service-context-empty.xml");
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNull(contextProvidersProperty);

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNull(propertyReadersProperty);
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNull(propertiesProperty);
    }
View Full Code Here

    public void testFeatureServiceFactoryPropertiesWithPropChildren() {
        setupContext("test-feature-service-context-no-prop-children.xml");
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNull(contextProvidersProperty);

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNull(propertyReadersProperty);
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNull(propertiesProperty);
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.PropertyValue

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.