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


Java TypedStringValue類代碼示例

本文整理匯總了Java中org.springframework.beans.factory.config.TypedStringValue的典型用法代碼示例。如果您正苦於以下問題:Java TypedStringValue類的具體用法?Java TypedStringValue怎麽用?Java TypedStringValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TypedStringValue類屬於org.springframework.beans.factory.config包,在下文中一共展示了TypedStringValue類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInterfaces

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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: convertClassesToStrings

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * Utility method used for maintaining backwards compatibility by converting Class objects to String (using their
 * class names). Used by importer and exporter parsing to set the 'interfaces' property.
 * 
 * @param parsedClasses collection of parsed classes
 * @return a collection of converted (if necessary) metadata
 */
public static Set<?> convertClassesToStrings(Set<?> parsedClasses) {
	Set<Object> interfaces = new ManagedSet<Object>(parsedClasses.size());

	for (Object clazz : parsedClasses) {
		if (clazz instanceof TypedStringValue || clazz instanceof String) {
			interfaces.add(clazz);
		} else {
			// add adapter definition for bean references (which can be classes)
			interfaces.add(BeanDefinitionBuilder.genericBeanDefinition(ToStringClassAdapter.class)
					.addConstructorArgValue(clazz).getBeanDefinition());
		}
	}

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

示例3: parseValueElement

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * Return a typed String value Object for the given value element.
 * 
 * @param ele element
 * @param defaultTypeName type class name
 * @return typed String value Object
 */
private Object parseValueElement(Element ele, String defaultTypeName) {
	// It's a literal value.
	String value = DomUtils.getTextValue(ele);
	String specifiedTypeName = ele.getAttribute(BeanDefinitionParserDelegate.TYPE_ATTRIBUTE);
	String typeName = specifiedTypeName;
	if (!StringUtils.hasText(typeName)) {
		typeName = defaultTypeName;
	}
	try {
		TypedStringValue typedValue = buildTypedStringValue(value, typeName);
		typedValue.setSource(extractSource(ele));
		typedValue.setSpecifiedTypeName(specifiedTypeName);
		return typedValue;
	} catch (ClassNotFoundException ex) {
		error("Type class [" + typeName + "] not found for <value> element", ele, ex);
		return value;
	}
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:26,代碼來源:BlueprintParser.java

示例4: parsePropsElement

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * Parse a props element.
 */
public Properties parsePropsElement(Element propsEle) {
	ManagedProperties props = new OrderedManagedProperties();
	props.setSource(extractSource(propsEle));
	props.setMergeEnabled(parseMergeAttribute(propsEle));

	List propEles = DomUtils.getChildElementsByTagName(propsEle, BeanDefinitionParserDelegate.PROP_ELEMENT);
	for (Iterator it = propEles.iterator(); it.hasNext();) {
		Element propEle = (Element) it.next();
		String key = propEle.getAttribute(BeanDefinitionParserDelegate.KEY_ATTRIBUTE);
		// Trim the text value to avoid unwanted whitespace
		// caused by typical XML formatting.
		String value = DomUtils.getTextValue(propEle).trim();

		TypedStringValue keyHolder = new TypedStringValue(key);
		keyHolder.setSource(extractSource(propEle));
		TypedStringValue valueHolder = new TypedStringValue(value);
		valueHolder.setSource(extractSource(propEle));
		props.put(keyHolder, valueHolder);
	}

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

示例5: parseValueElement

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * Return a typed String value Object for the given value element.
 */
public Object parseValueElement(Element ele, String defaultTypeName) {
	// It's a literal value.
	String value = DomUtils.getTextValue(ele);
	String specifiedTypeName = ele.getAttribute(TYPE_ATTRIBUTE);
	String typeName = specifiedTypeName;
	if (!StringUtils.hasText(typeName)) {
		typeName = defaultTypeName;
	}
	try {
		TypedStringValue typedValue = buildTypedStringValue(value, typeName);
		typedValue.setSource(extractSource(ele));
		typedValue.setSpecifiedTypeName(specifiedTypeName);
		return typedValue;
	}
	catch (ClassNotFoundException ex) {
		error("Type class [" + typeName + "] not found for <value> element", ele, ex);
		return value;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:BeanDefinitionParserDelegate.java

示例6: parsePropsElement

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * Parse a props element.
 */
public Properties parsePropsElement(Element propsEle) {
	ManagedProperties props = new ManagedProperties();
	props.setSource(extractSource(propsEle));
	props.setMergeEnabled(parseMergeAttribute(propsEle));

	List<Element> propEles = DomUtils.getChildElementsByTagName(propsEle, PROP_ELEMENT);
	for (Element propEle : propEles) {
		String key = propEle.getAttribute(KEY_ATTRIBUTE);
		// Trim the text value to avoid unwanted whitespace
		// caused by typical XML formatting.
		String value = DomUtils.getTextValue(propEle).trim();
		TypedStringValue keyHolder = new TypedStringValue(key);
		keyHolder.setSource(extractSource(propEle));
		TypedStringValue valueHolder = new TypedStringValue(value);
		valueHolder.setSource(extractSource(propEle));
		props.put(keyHolder, valueHolder);
	}

	return props;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:BeanDefinitionParserDelegate.java

示例7: addIncludePatterns

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:AspectJAutoProxyBeanDefinitionParser.java

示例8: postProcessBeanFactory

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例9: getClassForPropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例10: updatePropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例11: updatePropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例12: updatePropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例13: getStringValFromPVs

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例14: updatePropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的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

示例15: postProcessBeanFactory

import org.springframework.beans.factory.config.TypedStringValue; //導入依賴的package包/類
/**
 * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
 */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
{
    for (String bean : getSecurityBeanNames(beanFactory))
    {
        if (beanFactory.containsBeanDefinition(bean))
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Adding RM method security definitions for " + bean);
            }

            BeanDefinition beanDef = beanFactory.getBeanDefinition(bean);
            PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE);
            if (beanValue != null)
            {
                String beanStringValue = (String)((TypedStringValue)beanValue.getValue()).getValue();
                String mergedStringValue = merge(beanStringValue);
                beanDef.getPropertyValues().addPropertyValue(PROP_OBJECT_DEFINITION_SOURCE, new TypedStringValue(mergedStringValue));
            }
        }
    }
}
 
開發者ID:Alfresco,項目名稱:records-management-old,代碼行數:27,代碼來源:RMMethodSecurityPostProcessor.java


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