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


Java PropertyValue.getValue方法代碼示例

本文整理匯總了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() };
	}
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:24,代碼來源:MandatoryImporterDependencyFactory.java

示例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()]);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:BeanComponentDefinition.java

示例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);
}
 
開發者ID:epam,項目名稱:Lagerta,代碼行數:24,代碼來源:BaseActiveStoreConfiguration.java

示例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;
	}
}
 
開發者ID:paulcwarren,項目名稱:spring-content,代碼行數:32,代碼來源:StoreInterfaceAwareBeanPostProcessor.java

示例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;
	}
}
 
開發者ID:dianping,項目名稱:zebra,代碼行數:20,代碼來源:ZebraMapperScannerConfigurer.java

示例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;
	}
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:21,代碼來源:MapperScannerConfigurer.java

示例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;
  }
}
 
開發者ID:lindzh,項目名稱:mybatis-spring-1.2.2,代碼行數:20,代碼來源:MapperScannerConfigurer.java

示例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;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:33,代碼來源:UifBeanFactoryPostProcessor.java

示例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;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:29,代碼來源:MessageBeanProcessor.java

示例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;
    }
}
 
開發者ID:bingoohuang,項目名稱:spring-rest-client,代碼行數:20,代碼來源:SpringRestClientScannerConfigurer.java

示例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");
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:31,代碼來源:BeanDefinitionDtoConverterServiceImpl.java

示例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
	}
}
 
開發者ID:ricklindstrom,項目名稱:directed-graph-builder,代碼行數:22,代碼來源:SpringGraphBuilder.java

示例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());
	        }
	    }
	}
}
 
開發者ID:ricklindstrom,項目名稱:directed-graph-builder,代碼行數:25,代碼來源:SpringGraphBuilder.java

示例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();
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:13,代碼來源:MandatoryImporterDependencyFactory.java

示例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;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:10,代碼來源:MetadataUtils.java


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