本文整理匯總了Java中org.springframework.beans.PropertyValues.getPropertyValue方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyValues.getPropertyValue方法的具體用法?Java PropertyValues.getPropertyValue怎麽用?Java PropertyValues.getPropertyValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.PropertyValues
的用法示例。
在下文中一共展示了PropertyValues.getPropertyValue方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updatePropertyValue
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private String updatePropertyValue(String propertyName, PropertyValues values) {
PropertyValue property = values.getPropertyValue(propertyName);
if (property == null) {
return null;
}
Object value = property.getValue();
if (value == null) {
return null;
} else if (value instanceof String) {
return value.toString();
} else if (value instanceof TypedStringValue) {
return ((TypedStringValue) value).getValue();
} else {
return null;
}
}
示例2: updatePropertyValue
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private String updatePropertyValue(String propertyName,
PropertyValues values) {
PropertyValue property = values.getPropertyValue(propertyName);
if (property == null) {
return null;
}
Object value = property.getValue();
if (value == null) {
return null;
} else if (value instanceof String) {
return value.toString();
} else if (value instanceof TypedStringValue) {
return ((TypedStringValue) value).getValue();
} else {
return null;
}
}
示例3: updatePropertyValue
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private String updatePropertyValue(String propertyName, PropertyValues values) {
PropertyValue property = values.getPropertyValue(propertyName);
if (property == null) {
return null;
}
Object value = property.getValue();
if (value == null) {
return null;
} else if (value instanceof String) {
return value.toString();
} else if (value instanceof TypedStringValue) {
return ((TypedStringValue) value).getValue();
} else {
return null;
}
}
示例4: updatePropertyValue
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private String updatePropertyValue(String propertyName, PropertyValues values) {
PropertyValue property = values.getPropertyValue(propertyName);
if (property == null) {
return null;
}
Object value = property.getValue();
if (value == null) {
return null;
} else if (value instanceof String) {
return value.toString();
} else if (value instanceof TypedStringValue) {
return ((TypedStringValue) value).getValue();
} else {
return null;
}
}
示例5: 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;
}
示例6: changesSince
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
@Override
public PropertyValues changesSince(PropertyValues old) {
MutablePropertyValues changes = new MutablePropertyValues();
// for each property value in the new set
for (PropertyValue newValue : getPropertyValues()) {
// if there wasn't an old one, add it
PropertyValue oldValue = old.getPropertyValue(newValue.getName());
if (oldValue == null || !oldValue.equals(newValue)) {
changes.addPropertyValue(newValue);
}
}
return changes;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:PropertySourcesPropertyValues.java
示例7: processPropertyDescriptorsForXImplementation
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
* Process <i>ximplementation</i> dependencies for
* {@linkplain PropertyValues}.
* <p>
* Beans defined by annotations are handled here.
* </p>
*
* @param pvs
* @param pds
* @param bean
* @param beanName
* @throws BeansException
*/
protected void processPropertyDescriptorsForXImplementation(
PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
String beanName) throws BeansException
{
Class<?> beanClass = bean.getClass();
for (PropertyDescriptor pd : pds)
{
PropertyValue propertyValue = pvs.getPropertyValue(pd.getName());
// ignore if property value is set, they will be handled in
// #processPropertyValuesForXImplementation(...)
if (propertyValue != null && propertyValue.getValue() != null)
continue;
if (!isLlegalXImplementationProperty(beanClass, pd))
continue;
Class<?> propertyType = pd.getPropertyType();
Set<Class<?>> implementors = this.implementorManager
.get(propertyType);
// ignore if no implementor or only one implementor
if(implementors == null || implementors.size() < 2)
continue;
createAndRegisterImplementeeBeanDependency(propertyType,
implementors);
}
}
開發者ID:ximplementation,項目名稱:ximplementation-spring,代碼行數:45,代碼來源:ImplementeeBeanCreationPostProcessor.java
示例8: 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;
}
示例9: parseListener
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private void parseListener(Element containerEle, Element listenerEle, ParserContext parserContext,
PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) {
RootBeanDefinition listenerDef = new RootBeanDefinition();
listenerDef.setSource(parserContext.extractSource(listenerEle));
listenerDef.setBeanClassName("org.springframework.jms.listener.adapter.MessageListenerAdapter");
String ref = listenerEle.getAttribute(REF_ATTRIBUTE);
if (!StringUtils.hasText(ref)) {
parserContext.getReaderContext().error(
"Listener 'ref' attribute contains empty value.", listenerEle);
}
else {
listenerDef.getPropertyValues().add("delegate", new RuntimeBeanReference(ref));
}
String method = null;
if (listenerEle.hasAttribute(METHOD_ATTRIBUTE)) {
method = listenerEle.getAttribute(METHOD_ATTRIBUTE);
if (!StringUtils.hasText(method)) {
parserContext.getReaderContext().error(
"Listener 'method' attribute contains empty value.", listenerEle);
}
}
listenerDef.getPropertyValues().add("defaultListenerMethod", method);
PropertyValue messageConverterPv = commonContainerProperties.getPropertyValue("messageConverter");
if (messageConverterPv != null) {
listenerDef.getPropertyValues().addPropertyValue(messageConverterPv);
}
BeanDefinition containerDef = createContainer(
containerEle, listenerEle, parserContext, commonContainerProperties, specificContainerProperties);
containerDef.getPropertyValues().add("messageListener", listenerDef);
if (listenerEle.hasAttribute(RESPONSE_DESTINATION_ATTRIBUTE)) {
String responseDestination = listenerEle.getAttribute(RESPONSE_DESTINATION_ATTRIBUTE);
Boolean pubSubDomain = (Boolean) commonContainerProperties.getPropertyValue("replyPubSubDomain").getValue();
listenerDef.getPropertyValues().add(
pubSubDomain ? "defaultResponseTopicName" : "defaultResponseQueueName", responseDestination);
if (containerDef.getPropertyValues().contains("destinationResolver")) {
listenerDef.getPropertyValues().add("destinationResolver",
containerDef.getPropertyValues().getPropertyValue("destinationResolver").getValue());
}
}
String containerBeanName = listenerEle.getAttribute(ID_ATTRIBUTE);
// If no bean id is given auto generate one using the ReaderContext's BeanNameGenerator
if (!StringUtils.hasText(containerBeanName)) {
containerBeanName = parserContext.getReaderContext().generateBeanName(containerDef);
}
// Register the listener and fire event
parserContext.registerBeanComponent(new BeanComponentDefinition(containerDef, containerBeanName));
}
示例10: refresh
import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
@Override
public void refresh(ApplicationContext context, Map<Class<?>, ScanedType> scanedClasses) {
boolean needRefreshSessionFactory = false;
for (Entry<Class<?>, ScanedType> entry : scanedClasses.entrySet()) {
if (entry.getValue().getValue() > ScanedType.SAME.getValue()
&& entry.getKey().getAnnotation(Entity.class) != null) {
needRefreshSessionFactory = true;
break;
}
}
if (needRefreshSessionFactory) {
DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory) ((AbstractApplicationContext) context)
.getBeanFactory();
//testUserManager(dlbf);
final String sessionFactory = "sessionFactory";
final String annotatedClasses = "annotatedClasses";
final String setSessionFactory = "setSessionFactory";
BeanDefinition oldSessionFactoryDef = dlbf.getBeanDefinition(sessionFactory);
if (oldSessionFactoryDef != null) {
dlbf.removeBeanDefinition(sessionFactory);
MutablePropertyValues propertyValues = oldSessionFactoryDef.getPropertyValues();
PropertyValue oldPropertyValue = propertyValues.getPropertyValue(annotatedClasses);
propertyValues.removePropertyValue(annotatedClasses);
BeanDefinition newSessionFactoryDef = BeanDefinitionBuilder.rootBeanDefinition(
oldSessionFactoryDef.getBeanClassName()).getBeanDefinition();
List<PropertyValue> propertyValueList = newSessionFactoryDef.getPropertyValues().getPropertyValueList();
propertyValueList.addAll(propertyValues.getPropertyValueList());
propertyValueList.add(new PropertyValue(annotatedClasses, getManageList(dlbf, oldPropertyValue)));
dlbf.registerBeanDefinition(sessionFactory, newSessionFactoryDef);
SessionFactory sessionFactoryImpl = (SessionFactory) dlbf.getBean(sessionFactory);
String[] beanNames = dlbf.getBeanDefinitionNames();
for (String beanName : beanNames) {
BeanDefinition beanDefinition = dlbf.getBeanDefinition(beanName);
PropertyValues pValues = beanDefinition.getPropertyValues();
if (pValues.getPropertyValue(sessionFactory) != null) {
Object theBean = dlbf.getBean(beanName);
Method method = Utils.findMethod(theBean, setSessionFactory, sessionFactoryImpl);
if (method != null)
Utils.InvokedMethod(theBean, method, sessionFactoryImpl);
}
}
}
}
}