Example usage for javax.persistence.metamodel SetAttribute getBindableJavaType

List of usage examples for javax.persistence.metamodel SetAttribute getBindableJavaType

Introduction

In this page you can find the example usage for javax.persistence.metamodel SetAttribute getBindableJavaType.

Prototype

Class<T> getBindableJavaType();

Source Link

Document

Return the Java type of the represented object.

Usage

From source file:org.easy.criteria.CriteriaComposer.java

/**
 * Creates a set join with the next entity.
 * //  w w  w  .  jav a  2 s  .c o  m
 * @param <R>
 *            - Class of the next entity
 * @param attribute
 *            - SetAttribute of this entity that has reference to next
 *            entity
 * @return Sub criteria for the next entity
 */
@SuppressWarnings("unchecked")
public <V> CriteriaComposer<V> join(JoinType joinType, SetAttribute<? super E, V> attribute,
        CriteriaComposer<V> subCriteria) {
    Preconditions.checkNotNull(attribute);

    Class<V> classToJoin = attribute.getBindableJavaType();

    JoinContainer<E> join = new JoinContainer<E>(joinType, attribute);

    // Dont overwrite join
    if (_joins.containsKey(join))
        return (CriteriaComposer<V>) _joins.get(join);

    if (subCriteria == null)
        subCriteria = new CriteriaComposer<V>(classToJoin);

    _joins.put(join, subCriteria);

    log.debug("Addeding join " + joinType.toString() + " on " + classToJoin.getSimpleName() + " "
            + attribute.getName());

    return subCriteria;
}