Search in sources :

Example 1 with MethodExpressionException

use of org.apache.deltaspike.data.impl.builder.MethodExpressionException in project deltaspike by apache.

the class BasePropertyQueryPart method validate.

void validate(String name, String method, RepositoryMetadata repo) {
    Class<?> current = repo.getEntityMetadata().getEntityClass();
    if (name == null) {
        throw new MethodExpressionException(null, repo.getRepositoryClass(), method);
    }
    for (String property : name.split(SEPARATOR)) {
        PropertyQuery<?> query = PropertyQueries.createQuery(current).addCriteria(new NamedPropertyCriteria(property));
        Property<?> result = query.getFirstResult();
        if (result == null) {
            throw new MethodExpressionException(property, repo.getRepositoryClass(), method);
        }
        current = result.getJavaClass();
    }
}
Also used : MethodExpressionException(org.apache.deltaspike.data.impl.builder.MethodExpressionException) NamedPropertyCriteria(org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria)

Aggregations

MethodExpressionException (org.apache.deltaspike.data.impl.builder.MethodExpressionException)1 NamedPropertyCriteria (org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria)1