Example usage for javax.persistence.metamodel SingularAttribute toString

List of usage examples for javax.persistence.metamodel SingularAttribute toString

Introduction

In this page you can find the example usage for javax.persistence.metamodel SingularAttribute toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

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

/**
 * @param function/*from   w  ww .  ja  v a 2s  . com*/
 * @param attribute
 * @param alias
 * @return
 */
public <V> CriteriaComposer<E> select(AggregateFunction function, SingularAttribute<? super E, V> attribute,
        String alias) {
    Preconditions.checkNotNull(function);
    Preconditions.checkNotNull(attribute);

    if (alias == null || alias.trim().length() == 0)
        alias = function.toString().toLowerCase() + "." + this._entityClass.getSimpleName() + "."
                + attribute.getName();

    SelectContainer<E> selectContainer = new SelectContainer<E>(function, attribute, alias);

    int index = _selects.indexOf(selectContainer);

    if (index >= 0)
        _selects.add(index, selectContainer);
    else
        _selects.add(selectContainer);

    log.debug("Added select " + attribute.toString());

    return this;
}