本文整理匯總了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;
}
示例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.");
}
}
}
}
示例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.");
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}