本文整理汇总了Java中org.springframework.beans.PropertyValue.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyValue.getValue方法的具体用法?Java PropertyValue.getValue怎么用?Java PropertyValue.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.PropertyValue
的用法示例。
在下文中一共展示了PropertyValue.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInterfaces
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
private String[] getInterfaces(PropertyValue pv) {
if (pv == null)
return new String[0];
Object value = pv.getValue();
if (value instanceof Collection) {
Collection collection = (Collection) value;
String[] strs = new String[collection.size()];
int index = 0;
for (Object obj : collection) {
if (value instanceof TypedStringValue) {
strs[index] = ((TypedStringValue) value).getValue();
} else {
strs[index] = value.toString();
}
index++;
}
return strs;
} else {
return new String[] { value.toString() };
}
}
示例2: findInnerBeanDefinitionsAndBeanReferences
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
List<BeanReference> references = new ArrayList<BeanReference>();
PropertyValues propertyValues = beanDefinition.getPropertyValues();
for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
Object value = propertyValue.getValue();
if (value instanceof BeanDefinitionHolder) {
innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
}
else if (value instanceof BeanDefinition) {
innerBeans.add((BeanDefinition) value);
}
else if (value instanceof BeanReference) {
references.add((BeanReference) value);
}
}
this.innerBeanDefinitions = innerBeans.toArray(new BeanDefinition[innerBeans.size()]);
this.beanReferences = references.toArray(new BeanReference[references.size()]);
}
示例3: postProcessBeanFactory
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void postProcessBeanFactory(
ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
String[] igniteConfigNames = configurableListableBeanFactory.getBeanNamesForType(IgniteConfiguration.class);
if (igniteConfigNames.length != 1) {
throw new IllegalArgumentException("Spring config must contain exactly one ignite configuration!");
}
String[] activeStoreConfigNames = configurableListableBeanFactory.getBeanNamesForType(BaseActiveStoreConfiguration.class);
if (activeStoreConfigNames.length != 1) {
throw new IllegalArgumentException("Spring config must contain exactly one active store configuration!");
}
BeanDefinition igniteConfigDef = configurableListableBeanFactory.getBeanDefinition(igniteConfigNames[0]);
MutablePropertyValues propertyValues = igniteConfigDef.getPropertyValues();
if (!propertyValues.contains(USER_ATTRS_PROP_NAME)) {
propertyValues.add(USER_ATTRS_PROP_NAME, new ManagedMap());
}
PropertyValue propertyValue = propertyValues.getPropertyValue(USER_ATTRS_PROP_NAME);
Map userAttrs = (Map)propertyValue.getValue();
TypedStringValue key = new TypedStringValue(CONFIG_USER_ATTR);
RuntimeBeanReference value = new RuntimeBeanReference(beanName);
userAttrs.put(key, value);
}
示例4: getClassForPropertyValue
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* Returns the class which is configured in the given {@link PropertyValue}. In case it is not a
* {@link TypedStringValue} or the value contained cannot be interpreted as {@link Class} it will return null.
*
* @param propertyValue
* @param beanName
* @return
*/
private Class<?> getClassForPropertyValue(PropertyValue propertyValue, String beanName) {
Object value = propertyValue.getValue();
String className = null;
if (value instanceof TypedStringValue) {
className = ((TypedStringValue) value).getValue();
} else if (value instanceof String) {
className = (String) value;
} else if (value instanceof Class<?>) {
return (Class<?>) value;
} else {
return Void.class;
}
try {
return ClassUtils.resolveClassName(className, context.getBeanClassLoader());
} catch (IllegalArgumentException ex) {
LOGGER.warn(String.format("Couldn't load class %s referenced as repository interface in bean %s!", className,
beanName));
return Void.class;
}
}
示例5: updatePropertyValue
import org.springframework.beans.PropertyValue; //导入方法依赖的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;
}
}
示例6: updatePropertyValue
import org.springframework.beans.PropertyValue; //导入方法依赖的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;
}
}
示例7: updatePropertyValue
import org.springframework.beans.PropertyValue; //导入方法依赖的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;
}
}
示例8: getExpressionGraphFromParent
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* Retrieves the expression graph map set on the bean with given name. If the bean has not been processed
* by the bean factory post processor, that is done before retrieving the map
*
* @param parentBeanName name of the parent bean to retrieve map for (if empty a new map will be returned)
* @param beanFactory bean factory to retrieve bean definition from
* @param processedBeanNames set of bean names that have been processed so far
* @return expression graph map from parent or new instance
*/
protected Map<String, String> getExpressionGraphFromParent(String parentBeanName,
ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames) {
Map<String, String> expressionGraph = new HashMap<String, String>();
if (StringUtils.isBlank(parentBeanName) || !beanFactory.containsBeanDefinition(parentBeanName)) {
return expressionGraph;
}
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(parentBeanName);
if (!processedBeanNames.contains(parentBeanName)) {
processBeanDefinition(parentBeanName, beanDefinition, beanFactory, processedBeanNames);
}
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
PropertyValue propertyExpressionsPV = pvs.getPropertyValue(UifPropertyPaths.EXPRESSION_GRAPH);
if (propertyExpressionsPV != null) {
Object value = propertyExpressionsPV.getValue();
if ((value != null) && (value instanceof ManagedMap)) {
expressionGraph.putAll((ManagedMap) value);
}
}
return expressionGraph;
}
示例9: findPropertyValueInBeanDefinition
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* Attempts to find a property value for the given property name within the bean definition, if the property
* does not exist in the bean and there is a parent, the parent is checked for containing the property. This
* continues until a property value is found or all the parents have been traversed
*
* @param beanDefinition bean definition to find property value in
* @param propertyName name of the property to find the value for
* @return String value for property in the bean definition or null if the property was not found
*/
protected String findPropertyValueInBeanDefinition(BeanDefinition beanDefinition, String propertyName) {
String beanPropertyValue = null;
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
if (pvs.contains(propertyName)) {
PropertyValue propertyValue = pvs.getPropertyValue(propertyName);
if (propertyValue.getValue() != null) {
beanPropertyValue = propertyValue.getValue().toString();
}
} else {
if (StringUtils.isNotBlank(beanDefinition.getParentName())) {
BeanDefinition parentBeanDefinition = beanFactory.getBeanDefinition(beanDefinition.getParentName());
beanPropertyValue = findPropertyValueInBeanDefinition(parentBeanDefinition, propertyName);
}
}
return beanPropertyValue;
}
示例10: updatePropertyValue
import org.springframework.beans.PropertyValue; //导入方法依赖的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;
}
}
示例11: toDto
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* Convert from an internal Spring bean definition to a DTO.
*
* @param beanDefinition The internal Spring bean definition.
* @return Returns a DTO representation.
*/
public BeanDefinitionInfo toDto(BeanDefinition beanDefinition) {
if (beanDefinition instanceof GenericBeanDefinition) {
GenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo();
info.setClassName(beanDefinition.getBeanClassName());
if (beanDefinition.getPropertyValues() != null) {
Map<String, BeanMetadataElementInfo> propertyValues = new HashMap<String, BeanMetadataElementInfo>();
for (PropertyValue value : beanDefinition.getPropertyValues().getPropertyValueList()) {
Object obj = value.getValue();
if (obj instanceof BeanMetadataElement) {
propertyValues.put(value.getName(), toDto((BeanMetadataElement) obj));
} else {
throw new IllegalArgumentException("Type " + obj.getClass().getName()
+ " is not a BeanMetadataElement for property: " + value.getName());
}
}
info.setPropertyValues(propertyValues);
}
return info;
} else {
throw new IllegalArgumentException("Conversion to DTO of " + beanDefinition.getClass().getName()
+ " not implemented");
}
}
示例12: addFieldToNode
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* @param node
* @param v
*/
private void addFieldToNode(Graph.Node node, final PropertyValue v) {
if (v.getValue() instanceof TypedStringValue) {
if (!v.getName().toUpperCase().contains("PASSWORD")) {
node.addField(v.getName() + "=" + ((TypedStringValue) v.getValue()).getValue());
} else {
node.addField(v.getName() + "=********");
}
} else if (v.getValue() instanceof String | v.getValue() instanceof Boolean | v.getValue() instanceof Integer) {
node.addField(v.getName() + "=" + v.getValue());
} else if (v.getValue() instanceof BeanDefinitionHolder) {
node.addField(v.getName() + "=" + ((BeanDefinitionHolder) v.getValue()).getBeanDefinition().getBeanClassName());
} else if (!(v.getValue() instanceof RuntimeBeanReference)) {
node.addField(v.getName() + "=(" + v.getValue().getClass().getSimpleName() + ")");
} else {
//This is a RuntimeBeanReference which is handled as an edge
}
}
示例13: addGraphEdge
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
/**
* @param graph Graph
* @param beanId String
* @param v PropertyValue
*/
private static void addGraphEdge(final Graph graph, final String beanId, final PropertyValue v) {
if (v.getValue() instanceof RuntimeBeanReference) {
graph.addEdge(beanId, ((RuntimeBeanReference) v.getValue()).getBeanName());
} else if (v.getValue() instanceof ManagedList) {
ManagedList list = (ManagedList) v.getValue();
for (Object o : list) {
if (o instanceof RuntimeBeanReference) {
graph.addEdge(beanId, ((RuntimeBeanReference) o).getBeanName());
}
}
} else if (v.getValue() instanceof ManagedMap) {
ManagedMap map = (ManagedMap) v.getValue();
for (Object value : map.values()) {
if (value instanceof RuntimeBeanReference) {
graph.addEdge(beanId, ((RuntimeBeanReference) value).getBeanName());
}
}
}
}
示例14: getString
import org.springframework.beans.PropertyValue; //导入方法依赖的package包/类
private String getString(PropertyValue pv) {
if (pv == null)
return "";
Object value = pv.getValue();
if (value == null) {
return "";
}
if (value instanceof TypedStringValue) {
return ((TypedStringValue) value).getValue();
}
return value.toString();
}
示例15: getValue
import org.springframework.beans.PropertyValue; //导入方法依赖的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;
}