Example usage for org.springframework.data.mapping PropertyReferenceException PropertyReferenceException

List of usage examples for org.springframework.data.mapping PropertyReferenceException PropertyReferenceException

Introduction

In this page you can find the example usage for org.springframework.data.mapping PropertyReferenceException PropertyReferenceException.

Prototype

public PropertyReferenceException(String propertyName, TypeInformation<?> type,
        List<PropertyPath> alreadyResolvedPah) 

Source Link

Document

Creates a new PropertyReferenceException .

Usage

From source file:org.springframework.data.mapping.PropertyPath.java

/**
 * Creates a leaf {@link PropertyPath} (no nested ones with the given name and owning type.
 * //from w ww . j av  a  2  s  .co m
 * @param name must not be {@literal null} or empty.
 * @param owningType must not be {@literal null}.
 * @param base the {@link PropertyPath} previously found.
 */
PropertyPath(String name, TypeInformation<?> owningType, List<PropertyPath> base) {

    Assert.hasText(name);
    Assert.notNull(owningType);

    String propertyName = name.matches(ALL_UPPERCASE) ? name : StringUtils.uncapitalize(name);
    boolean isSpecli = org.apache.commons.lang3.StringUtils.contains(propertyName, "*");

    String _propertyName = isSpecli
            ? propertyName.replaceAll("\\*(.*)", org.apache.commons.lang3.StringUtils.EMPTY)
            : propertyName;

    if (propertyName.startsWith("iF")) {
        _propertyName = "name";
    }
    TypeInformation<?> propertyType = owningType.getProperty(_propertyName);

    if (!isSpecli) {
        if (propertyType == null) {
            throw new PropertyReferenceException(propertyName, owningType, base);
        }
    } else {

        if (true) {
            //for debug
        }

    }

    this.owningType = owningType;
    this.isCollection = propertyType == null ? false : propertyType.isCollectionLike();

    if (propertyType == null) {
        throw new PropertyReferenceException(_propertyName, owningType, base);
    }
    this.type = propertyType.getActualType();
    this.name = propertyName;
}