src/main/java/com/tri/persistence/jpql/SelectQueryClause.java
public <T> QueryBuilder add(final String lhsStatement,
			final Class<T> constructorClass, final String expression) {

		StringBuilder itemBuilder = new StringBuilder();
		if (lhsStatement != null) {
			itemBuilder.append(lhsStatement);
			itemBuilder.append(" ");
		}
		itemBuilder.append("NEW ");
		itemBuilder.append(constructorClass.getName());
		itemBuilder.append("(");
		itemBuilder.append(expression);
		itemBuilder.append(")");

		items.add(itemBuilder.toString());

		return builder;

	}
public <T> QueryBuilder add(final String lhsStatement,
			final Class<T> constructorClass, final String expression) {

		StringBuilder itemBuilder = new StringBuilder();
		if (lhsStatement != null) {
			itemBuilder.append(lhsStatement);
			itemBuilder.append(" ");
		}
		itemBuilder.append("NEW ");
		itemBuilder.append(constructorClass.getName());
		itemBuilder.append("(");
		itemBuilder.append(expression);
		itemBuilder.append(")");

		items.add(itemBuilder.toString());

		return builder;

	}
public < T > QueryBuilder add ( final String lhsStatement , final Class < T > constructorClass , final String expression ) { StringBuilder itemBuilder = new StringBuilder ( ) ; if ( lhsStatement != null ) { itemBuilder . append ( lhsStatement ) ; itemBuilder . append ( " " ) ; } itemBuilder . append ( "NEW " ) ; itemBuilder . append ( constructorClass . getName ( ) ) ; itemBuilder . append ( "(" ) ; itemBuilder . append ( expression ) ; itemBuilder . append ( ")" ) ; items . add ( itemBuilder . toString ( ) ) ; return builder ; }
Adds an expression to this Select Clause with support for Constructor
Expressions.

@param lhsStatement
left hand side of the statement, e.g. {@code DISTINCT}
@param constructorClass
class to be use for Constructor Expression, make sure it has a
constructor that fits to the given {@literal SQL} Select Items
@param expression
expression used as constructor parameter, will be passed
unchanged to the appropriated constructor of the given class
@return the query builder
Adds an expression to this Select Clause with support for Constructor Expressions .