Example usage for org.springframework.beans BeanWrapperImpl getCachedIntrospectionResults

List of usage examples for org.springframework.beans BeanWrapperImpl getCachedIntrospectionResults

Introduction

In this page you can find the example usage for org.springframework.beans BeanWrapperImpl getCachedIntrospectionResults.

Prototype

private CachedIntrospectionResults getCachedIntrospectionResults() 

Source Link

Document

Obtain a lazily initialized CachedIntrospectionResults instance for the wrapped object.

Usage

From source file:org.springframework.beans.BeanWrapperImpl.java

/**
 * Internal version of {@link #getPropertyDescriptor}:
 * Returns {@code null} if not found rather than throwing an exception.
 * @param propertyName the property to obtain the descriptor for
 * @return the property descriptor for the specified property,
 * or {@code null} if not found//from w w  w  . ja v  a 2  s.c  om
 * @throws BeansException in case of introspection failure
 */
protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName) throws BeansException {
    Assert.notNull(propertyName, "Property name must not be null");
    BeanWrapperImpl nestedBw = getBeanWrapperForPropertyPath(propertyName);
    return nestedBw.getCachedIntrospectionResults().getPropertyDescriptor(getFinalPath(nestedBw, propertyName));
}

From source file:org.springframework.beans.BeanWrapperImpl.java

@Override
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
    try {/*  w w w.j  ava 2 s. c o m*/
        BeanWrapperImpl nestedBw = getBeanWrapperForPropertyPath(propertyName);
        String finalPath = getFinalPath(nestedBw, propertyName);
        PropertyTokenHolder tokens = getPropertyNameTokens(finalPath);
        PropertyDescriptor pd = nestedBw.getCachedIntrospectionResults()
                .getPropertyDescriptor(tokens.actualName);
        if (pd != null) {
            if (tokens.keys != null) {
                if (pd.getReadMethod() != null || pd.getWriteMethod() != null) {
                    return TypeDescriptor.nested(property(pd), tokens.keys.length);
                }
            } else {
                if (pd.getReadMethod() != null || pd.getWriteMethod() != null) {
                    return new TypeDescriptor(property(pd));
                }
            }
        }
    } catch (InvalidPropertyException ex) {
        // Consider as not determinable.
    }
    return null;
}