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


Java TypedStringValue.getValue方法代碼示例

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


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

示例1: 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

示例2: getStringValue

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
/**
 * Determines whether the given value is of String type and if so returns the string value
 *
 * @param value object value to check
 * @return string value for object or null if object is not a string type
 */
protected String getStringValue(Object value) {
    if (value instanceof TypedStringValue) {
        TypedStringValue typedStringValue = (TypedStringValue) value;
        return typedStringValue.getValue();
    } else if (value instanceof String) {
        return (String) value;
    }

    return null;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:17,代碼來源:UifBeanFactoryPostProcessor.java

示例3: getString

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
/**
 * Determines whether the given value is of String type and if so returns the string value
 *
 * @param value object value to check
 * @return String string value for object or null if object is not a string type
 */
protected String getString(Object value) {
    String stringValue = null;

    if (value instanceof TypedStringValue || (value instanceof String)) {
        if (value instanceof TypedStringValue) {
            TypedStringValue typedStringValue = (TypedStringValue) value;
            stringValue = typedStringValue.getValue();
        } else {
            stringValue = (String) value;
        }
    }

    return stringValue;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:21,代碼來源:DictionaryBeanFactoryPostProcessor.java

示例4: getStringValue

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
/**
 * Determines whether the given value is of String type and if so returns the string value
 *
 * @param value object value to check
 * @return String string value for object or null if object is not a string type
 */
protected String getStringValue(Object value) {
    if (value instanceof TypedStringValue) {
        TypedStringValue typedStringValue = (TypedStringValue) value;
        return typedStringValue.getValue();
    } else if (value instanceof String) {
        return (String) value;
    }

    return null;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:17,代碼來源:DictionaryBeanProcessorBase.java

示例5: useSPEL

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
private boolean useSPEL(TypedStringValue stringValue)
{
    if (!enableSPEL || stringValue == null || stringValue.getValue() == null)
    {
        return false;
    }
    String trimmedValue = stringValue.getValue().trim();
    return trimmedValue.startsWith("#{") && trimmedValue.endsWith("}");
}
 
開發者ID:Doloops,項目名稱:arondor-common-reflection,代碼行數:10,代碼來源:BeanPropertyParser.java

示例6: processPropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
/**
 * Processes the given property name/value pair for complex objects, such as bean definitions or collections,
 * which if found will be processed for contained property expression values
 *
 * @param nestedPropertyName nested path of the property whose value is being processed
 * @param propertyName name of the property in the bean definition being processed
 * @param propertyValue value to check
 * @param beanDefinition bean definition the property belongs to
 * @param parentExpressionGraph map that holds property expressions for the parent bean definition, used for
 * merging
 * @param expressionGraph map that holds property expressions for the bean definition being processed
 * @param beanFactory bean factory that contains the bean definition being processed
 * @param processedBeanNames set of bean names that have been processed so far
 * @return new value to set for property
 */
protected Object processPropertyValue(String nestedPropertyName, String propertyName, Object propertyValue,
        BeanDefinition beanDefinition, Map<String, String> parentExpressionGraph,
        Map<String, String> expressionGraph, ConfigurableListableBeanFactory beanFactory,
        Set<String> processedBeanNames) {
    boolean clearExpressionsForNull = false;
    if (propertyValue instanceof TypedStringValue) {
        TypedStringValue typedStringValue = (TypedStringValue) propertyValue;

        String value = typedStringValue.getValue();
        if (value == null) {
            clearExpressionsForNull = true;
        }
    } else if (propertyValue == null) {
        clearExpressionsForNull = true;
    }

    // if property is object and set to null, clear any parent expressions for the property
    if (clearExpressionsForNull) {
        removeExpressionsByPrefix(nestedPropertyName, expressionGraph);
        removeExpressionsByPrefix(propertyName, parentExpressionGraph);

        return propertyValue;
    }

    // process nested bean definitions
    if ((propertyValue instanceof BeanDefinition) || (propertyValue instanceof BeanDefinitionHolder)) {
        String beanName = null;
        BeanDefinition beanDefinitionValue;
        if (propertyValue instanceof BeanDefinition) {
            beanDefinitionValue = (BeanDefinition) propertyValue;
        } else {
            beanDefinitionValue = ((BeanDefinitionHolder) propertyValue).getBeanDefinition();
            beanName = ((BeanDefinitionHolder) propertyValue).getBeanName();
        }

        // since overriding the entire bean, clear any expressions from parent that start with the bean property
        removeExpressionsByPrefix(nestedPropertyName, expressionGraph);
        removeExpressionsByPrefix(propertyName, parentExpressionGraph);

        processNestedBeanDefinition(beanName, beanDefinitionValue, nestedPropertyName, expressionGraph, beanFactory,
                processedBeanNames);

        return propertyValue;
    }

    // recurse into collections
    if (propertyValue instanceof Object[]) {
        visitArray(nestedPropertyName, parentExpressionGraph, expressionGraph, (Object[]) propertyValue,
                beanFactory,
                processedBeanNames);
    } else if (propertyValue instanceof List) {
        visitList(nestedPropertyName, propertyName, beanDefinition, parentExpressionGraph, expressionGraph,
                (List) propertyValue, beanFactory, processedBeanNames);
    } else if (propertyValue instanceof Set) {
        visitSet(nestedPropertyName, parentExpressionGraph, expressionGraph, (Set) propertyValue, beanFactory,
                processedBeanNames);
    } else if (propertyValue instanceof Map) {
        visitMap(nestedPropertyName, parentExpressionGraph, expressionGraph, (Map) propertyValue, beanFactory,
                processedBeanNames);
    }

    // others (primitive) just return value as is
    return propertyValue;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:80,代碼來源:UifBeanFactoryPostProcessor.java

示例7: processPropertyValue

import org.springframework.beans.factory.config.TypedStringValue; //導入方法依賴的package包/類
/**
 * Processes the given property name/value pair for complex objects, such as bean definitions or collections,
 * which if found will be processed for contained property expression values
 *
 * @param nestedPropertyName nested path of the property whose value is being processed
 * @param propertyName name of the property in the bean definition being processed
 * @param propertyValue value to check
 * @param beanDefinition bean definition the property belongs to
 * @param parentExpressionGraph map that holds property expressions for the parent bean definition, used for
 * merging
 * @param expressionGraph map that holds property expressions for the bean definition being processed
 * @param beanFactory bean factory that contains the bean definition being processed
 * @param processedBeanNames set of bean names that have been processed so far
 * @return new value to set for property
 */
protected Object processPropertyValue(String nestedPropertyName, String propertyName, Object propertyValue,
        BeanDefinition beanDefinition, Map<String, String> parentExpressionGraph,
        Map<String, String> expressionGraph, ConfigurableListableBeanFactory beanFactory,
        Set<String> processedBeanNames) {
    boolean clearExpressionsForNull = false;
    if (propertyValue instanceof TypedStringValue) {
        TypedStringValue typedStringValue = (TypedStringValue) propertyValue;

        String value = typedStringValue.getValue();
        if (value == null) {
            clearExpressionsForNull = true;
        }
    } else if (propertyValue == null) {
        clearExpressionsForNull = true;
    }

    // if property is object and set to null, clear any parent expressions for the property
    if (clearExpressionsForNull) {
        removeExpressionsByPrefix(nestedPropertyName, expressionGraph);
        removeExpressionsByPrefix(propertyName, parentExpressionGraph);

        return propertyValue;
    }

    // process nested bean definitions
    if ((propertyValue instanceof BeanDefinition) || (propertyValue instanceof BeanDefinitionHolder)) {
        String beanName = null;
        BeanDefinition beanDefinitionValue;
        if (propertyValue instanceof BeanDefinition) {
            beanDefinitionValue = (BeanDefinition) propertyValue;
        } else {
            beanDefinitionValue = ((BeanDefinitionHolder) propertyValue).getBeanDefinition();
            beanName = ((BeanDefinitionHolder) propertyValue).getBeanName();
        }

        // since overriding the entire bean, clear any expressions from parent that start with the bean property
        removeExpressionsByPrefix(nestedPropertyName, expressionGraph);
        removeExpressionsByPrefix(propertyName, parentExpressionGraph);

        processNestedBeanDefinition(beanName, beanDefinitionValue, nestedPropertyName, expressionGraph, beanFactory,
                processedBeanNames);

        return propertyValue;
    }

    // recurse into collections
    if (propertyValue instanceof Object[]) {
        visitArray(nestedPropertyName, parentExpressionGraph, expressionGraph, (Object[]) propertyValue, beanFactory,
                processedBeanNames);
    } else if (propertyValue instanceof List) {
        visitList(nestedPropertyName, propertyName, beanDefinition, parentExpressionGraph, expressionGraph,
                (List) propertyValue, beanFactory, processedBeanNames);
    } else if (propertyValue instanceof Set) {
        visitSet(nestedPropertyName, parentExpressionGraph, expressionGraph, (Set) propertyValue, beanFactory,
                processedBeanNames);
    } else if (propertyValue instanceof Map) {
        visitMap(nestedPropertyName, parentExpressionGraph, expressionGraph, (Map) propertyValue, beanFactory,
                processedBeanNames);
    }

    // others (primitive) just return value as is
    return propertyValue;
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:79,代碼來源:UifBeanFactoryPostProcessor.java


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