Example usage for javax.persistence TupleElement getJavaType

List of usage examples for javax.persistence TupleElement getJavaType

Introduction

In this page you can find the example usage for javax.persistence TupleElement getJavaType.

Prototype

Class<? extends X> getJavaType();

Source Link

Document

Return the Java type of the tuple element.

Usage

From source file:com.evanzeimet.queryinfo.jpa.result.AbstractTupleToPojoQueryInfoResultConverter.java

protected MethodHandle getMethodHandleForElement(TupleElement<?> element) throws QueryInfoException {
    String elementAlias = element.getAlias();
    String memberName = attributeUtils.convertAttributeNameToMemberName(elementAlias);
    Class<?> elementJavaType = element.getJavaType();

    MethodHandle result = findFieldSetterHandle(memberName, elementJavaType);

    if (result == null) {
        result = findFieldPutHandle(memberName, elementJavaType);
    }/*from w  w  w. j a v  a  2s  . c o m*/

    if (result == null) {
        String message = String.format("Could not find accessible setter or field for attribute [%s]",
                elementAlias);
        throw new QueryInfoException(message);
    }

    return result;
}