當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyValues.contains方法代碼示例

本文整理匯總了Java中org.springframework.beans.PropertyValues.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyValues.contains方法的具體用法?Java PropertyValues.contains怎麽用?Java PropertyValues.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.PropertyValues的用法示例。


在下文中一共展示了PropertyValues.contains方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postProcessPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
@Override
public PropertyValues postProcessPropertyValues(
		PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName)
		throws BeansException {

	if (!this.validatedBeanNames.contains(beanName)) {
		if (!shouldSkip(this.beanFactory, beanName)) {
			List<String> invalidProperties = new ArrayList<String>();
			for (PropertyDescriptor pd : pds) {
				if (isRequiredProperty(pd) && !pvs.contains(pd.getName())) {
					invalidProperties.add(pd.getName());
				}
			}
			if (!invalidProperties.isEmpty()) {
				throw new BeanInitializationException(buildExceptionMessage(invalidProperties, beanName));
			}
		}
		this.validatedBeanNames.add(beanName);
	}
	return pvs;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:RequiredAnnotationBeanPostProcessor.java

示例2: checkDependencies

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Perform a dependency check that all properties exposed have been set,
 * if desired. Dependency checks can be objects (collaborating beans),
 * simple (primitives and String), or all (both).
 * @param beanName the name of the bean
 * @param mbd the merged bean definition the bean was created with
 * @param pds the relevant property descriptors for the target bean
 * @param pvs the property values to be applied to the bean
 * @see #isExcludedFromDependencyCheck(java.beans.PropertyDescriptor)
 */
protected void checkDependencies(
		String beanName, AbstractBeanDefinition mbd, PropertyDescriptor[] pds, PropertyValues pvs)
		throws UnsatisfiedDependencyException {

	int dependencyCheck = mbd.getDependencyCheck();
	for (PropertyDescriptor pd : pds) {
		if (pd.getWriteMethod() != null && !pvs.contains(pd.getName())) {
			boolean isSimple = BeanUtils.isSimpleProperty(pd.getPropertyType());
			boolean unsatisfied = (dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_ALL) ||
					(isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_SIMPLE) ||
					(!isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
			if (unsatisfied) {
				throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, pd.getName(),
						"Set this property value or disable dependency checking for this bean.");
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:AbstractAutowireCapableBeanFactory.java

示例3: checkDependencies

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * 
 * ִ��һ�������Լ�飬�������ع�������ѱ�����
 * <p>
 * Perform a dependency check that all properties exposed have been set, if
 * desired. Dependency checks can be objects (collaborating beans), simple
 * (primitives and String), or all (both).
 * 
 * @param beanName
 *            the name of the bean
 * @param mbd
 *            the merged bean definition the bean was created with
 * @param pds
 *            the relevant property descriptors for the target bean
 * @param pvs
 *            the property values to be applied to the bean
 * @see #isExcludedFromDependencyCheck(java.beans.PropertyDescriptor)
 */
protected void checkDependencies(
		String beanName, AbstractBeanDefinition mbd, PropertyDescriptor[] pds, PropertyValues pvs)
		throws UnsatisfiedDependencyException {

	int dependencyCheck = mbd.getDependencyCheck();
	for (PropertyDescriptor pd : pds) {
		
		if (pd.getWriteMethod() != null && !pvs.contains(pd.getName())) {
			
			boolean isSimple = BeanUtils.isSimpleProperty(pd.getPropertyType());
			
			boolean unsatisfied = (dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_ALL) ||
					(isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_SIMPLE) ||
					(!isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
			// �����㣬���쳣
			if (unsatisfied) {
				throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, pd.getName(),
						"Set this property value or disable dependency checking for this bean.");
			}
		}
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:41,代碼來源:AbstractAutowireCapableBeanFactory.java

示例4: getStringValFromPVs

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Helper method for getting the string value of a property from a {@link PropertyValues}
 *
 * @param propertyValues property values instance to pull from
 * @param propertyName name of property whose value should be retrieved
 * @return String value for property or null if property was not found
 */
public static String getStringValFromPVs(PropertyValues propertyValues, String propertyName) {
    String propertyValue = null;

    if ((propertyValues != null) && propertyValues.contains(propertyName)) {
        Object pvValue = propertyValues.getPropertyValue(propertyName).getValue();
        if (pvValue instanceof TypedStringValue) {
            TypedStringValue typedStringValue = (TypedStringValue) pvValue;
            propertyValue = typedStringValue.getValue();
        } else if (pvValue instanceof String) {
            propertyValue = (String) pvValue;
        }
    }

    return propertyValue;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:23,代碼來源:ViewModelUtils.java

示例5: postProcessPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
@Override
public PropertyValues postProcessPropertyValues(
		PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName)
		throws BeansException {

	if (!this.validatedBeanNames.containsKey(beanName)) {
		if (!shouldSkip(this.beanFactory, beanName)) {
			List<String> invalidProperties = new ArrayList<String>();
			for (PropertyDescriptor pd : pds) {
				if (isRequiredProperty(pd) && !pvs.contains(pd.getName())) {
					invalidProperties.add(pd.getName());
				}
			}
			if (!invalidProperties.isEmpty()) {
				throw new BeanInitializationException(buildExceptionMessage(invalidProperties, beanName));
			}
		}
		this.validatedBeanNames.put(beanName, Boolean.TRUE);
	}
	return pvs;
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:22,代碼來源:RequiredAnnotationBeanPostProcessor.java

示例6: postProcessPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
		String beanName) throws BeansException {

	MutablePropertyValues newprops = new MutablePropertyValues(pvs);
	for (PropertyDescriptor pd : pds) {
		ServiceReference s = hasServiceProperty(pd);
		if (s != null && !pvs.contains(pd.getName())) {
			try {
				if (logger.isDebugEnabled())
					logger.debug("Processing annotation [" + s + "] for [" + beanName + "." + pd.getName() + "]");
				FactoryBean importer = getServiceImporter(s, pd.getWriteMethod(), beanName);
				// BPPs are created in stageOne(), even though they are run in stageTwo(). This check means that
				// the call to getObject() will not fail with ServiceUnavailable. This is safe to do because
				// ServiceReferenceDependencyBeanFactoryPostProcessor will ensure that mandatory services are
				// satisfied before stageTwo() is run.
				if (bean instanceof BeanPostProcessor) {
					ImporterCallAdapter.setCardinality(importer, Availability.OPTIONAL);
				}
				newprops.addPropertyValue(pd.getName(), importer.getObject());
			}
			catch (Exception e) {
				throw new FatalBeanException("Could not create service reference", e);
			}
		}
	}
	return newprops;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:28,代碼來源:ServiceReferenceInjectionBeanPostProcessor.java

示例7: getValue

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
static Object getValue(PropertyValues pvs, String name) {
	if (pvs.contains(name)) {
		PropertyValue pv = pvs.getPropertyValue(name);
		// return (pv.isConverted() ? pv.getConvertedValue() : pv.getValue());
		return pv.getValue();
	}

	return null;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:10,代碼來源:MetadataUtils.java

示例8: checkPropertySkipping

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Checks whether this injector's property needs to be skipped due to
 * an explicit property value having been specified. Also marks the
 * affected property as processed for other processors to ignore it.
 */
protected boolean checkPropertySkipping(PropertyValues pvs) {
	if (this.skip != null) {
		return this.skip;
	}
	if (pvs == null) {
		this.skip = false;
		return false;
	}
	synchronized (pvs) {
		if (this.skip != null) {
			return this.skip;
		}
		if (this.pd != null) {
			if (pvs.contains(this.pd.getName())) {
				// Explicit value provided as part of the bean definition.
				this.skip = true;
				return true;
			}
			else if (pvs instanceof MutablePropertyValues) {
				((MutablePropertyValues) pvs).registerProcessedProperty(this.pd.getName());
			}
		}
		this.skip = false;
		return false;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:InjectionMetadata.java

示例9: unsatisfiedNonSimpleProperties

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Return an array of non-simple bean properties that are unsatisfied.
 * These are probably unsatisfied references to other beans in the
 * factory. Does not include simple properties like primitives or Strings.
 * @param mbd the merged bean definition the bean was created with
 * @param bw the BeanWrapper the bean was created with
 * @return an array of bean property names
 * @see org.springframework.beans.BeanUtils#isSimpleProperty
 */
protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {
	Set<String> result = new TreeSet<String>();
	PropertyValues pvs = mbd.getPropertyValues();
	PropertyDescriptor[] pds = bw.getPropertyDescriptors();
	for (PropertyDescriptor pd : pds) {
		if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName()) &&
				!BeanUtils.isSimpleProperty(pd.getPropertyType())) {
			result.add(pd.getName());
		}
	}
	return StringUtils.toStringArray(result);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:AbstractAutowireCapableBeanFactory.java

示例10: checkPropertySkipping

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Check whether this injector's property needs to be skipped due to
 * an explicit property value having been specified. Also marks the
 * affected property as processed for other processors to ignore it.
 */
protected boolean checkPropertySkipping(PropertyValues pvs) {
	if (this.skip != null) {
		return this.skip;
	}
	if (pvs == null) {
		this.skip = false;
		return false;
	}
	synchronized (pvs) {
		if (this.skip != null) {
			return this.skip;
		}
		if (this.pd != null) {
			if (pvs.contains(this.pd.getName())) {
				// Explicit value provided as part of the bean definition.
				this.skip = true;
				return true;
			}
			else if (pvs instanceof MutablePropertyValues) {
				((MutablePropertyValues) pvs).registerProcessedProperty(this.pd.getName());
			}
		}
		this.skip = false;
		return false;
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:32,代碼來源:InjectionMetadata.java

示例11: unsatisfiedNonSimpleProperties

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
	 * Return an array of non-simple bean properties that are unsatisfied.
	 * These are probably unsatisfied references to other beans in the
	 * factory. Does not include simple properties like primitives or Strings.
	 * @param mbd the merged bean definition the bean was created with
	 * @param bw the BeanWrapper the bean was created with
	 * @return an array of bean property names
	 * @see org.springframework.beans.BeanUtils#isSimpleProperty
	 */
	protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {
		Set<String> result = new TreeSet<String>();
		PropertyValues pvs = mbd.getPropertyValues();
		PropertyDescriptor[] pds = bw.getPropertyDescriptors();
		for (PropertyDescriptor pd : pds) {
//			��ȡ����дֵ�ķ���������
			if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName()) &&
					!BeanUtils.isSimpleProperty(pd.getPropertyType())) {
				
				result.add(pd.getName());
			}
		}
		return StringUtils.toStringArray(result);
	}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:24,代碼來源:AbstractAutowireCapableBeanFactory.java

示例12: getDictionaryBeanProperty

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Returns a property value for the bean with the given name from the dictionary.
 *
 * @param beanName id or name for the bean definition
 * @param propertyName name of the property to retrieve, must be a valid property configured on
 * the bean definition
 * @return Object property value for property
 */
public Object getDictionaryBeanProperty(String beanName, String propertyName) {
    Object bean = ddBeans.getSingleton(beanName);
    if (bean != null) {
        return ObjectPropertyUtils.getPropertyValue(bean, propertyName);
    }

    BeanDefinition beanDefinition = ddBeans.getMergedBeanDefinition(beanName);

    if (beanDefinition == null) {
        throw new RuntimeException("Unable to get bean for bean name: " + beanName);
    }

    PropertyValues pvs = beanDefinition.getPropertyValues();
    if (pvs.contains(propertyName)) {
        PropertyValue propertyValue = pvs.getPropertyValue(propertyName);

        Object value;
        if (propertyValue.isConverted()) {
            value = propertyValue.getConvertedValue();
        } else if (propertyValue.getValue() instanceof String) {
            String unconvertedValue = (String) propertyValue.getValue();
            Scope scope = ddBeans.getRegisteredScope(beanDefinition.getScope());
            BeanExpressionContext beanExpressionContext = new BeanExpressionContext(ddBeans, scope);

            value = ddBeans.getBeanExpressionResolver().evaluate(unconvertedValue, beanExpressionContext);
        } else {
            value = propertyValue.getValue();
        }

        return value;
    }

    return null;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:43,代碼來源:DataDictionary.java

示例13: postProcessPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
		String beanName) throws BeansException {

	MutablePropertyValues newprops = new MutablePropertyValues(pvs);
	for (PropertyDescriptor pd : pds) {
		ServiceReference s = hasServiceProperty(pd);
		if (s != null && !pvs.contains(pd.getName())) {
			try {
				if (logger.isDebugEnabled())
					logger.debug("Processing annotation [" + s + "] for [" + beanName + "." + pd.getName() + "]");
				FactoryBean importer = getServiceImporter(s, pd.getWriteMethod(), beanName);
				// BPPs are created in stageOne(), even though they are run in stageTwo(). This check means that
				// the call to getObject() will not fail with ServiceUnavailable. This is safe to do because
				// ServiceReferenceDependencyBeanFactoryPostProcessor will ensure that mandatory services are
				// satisfied before stageTwo() is run.
				if (bean instanceof BeanPostProcessor) {
					ImporterCallAdapter.setCardinality(importer, Cardinality.C_0__1);
				}
				newprops.addPropertyValue(pd.getName(), importer.getObject());
			}
			catch (Exception e) {
				throw new FatalBeanException("Could not create service reference", e);
			}
		}
	}
	return newprops;
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:28,代碼來源:ServiceReferenceInjectionBeanPostProcessor.java

示例14: postProcessPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
@Override
@SuppressWarnings("rawtypes")
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
        String beanName) throws BeansException {

    MutablePropertyValues newprops = new MutablePropertyValues(pvs);
    for (PropertyDescriptor pd : pds) {
        A s = hasAnnotatedProperty(pd);
        if (s != null && !pvs.contains(pd.getName())) {
            try {
                if (logger.isDebugEnabled())
                    logger.debug("Processing annotation [" + s + "] for [" + beanName + "." + pd.getName() + "]");
                FactoryBean importer = getServiceImporter(s, pd.getWriteMethod(), beanName);
                // BPPs are created in stageOne(), even though they are run in stageTwo(). This check means that
                // the call to getObject() will not fail with ServiceUnavailable. This is safe to do because
                // ServiceReferenceDependencyBeanFactoryPostProcessor will ensure that mandatory services are
                // satisfied before stageTwo() is run.
                if (bean instanceof BeanPostProcessor) {
                    ImporterCallAdapter.setCardinality(importer, Cardinality.C_0__1);
                }
                newprops.addPropertyValue(pd.getName(), importer.getObject());
            }
            catch (Exception e) {
                throw new FatalBeanException("Could not create service reference", e);
            }
        }
    }
    return newprops;
}
 
開發者ID:twachan,項目名稱:James,代碼行數:30,代碼來源:AbstractOSGIAnnotationBeanPostProcessor.java


注:本文中的org.springframework.beans.PropertyValues.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。