All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ibatis.persist.impl.function.BasicFunctionExpression Maven / Gradle / Ivy

Go to download

The jBATIS persistence framework will help you to significantly reduce the amount of Java code that you normally need to access a relational database. iBATIS simply maps JavaBeans to SQL statements using a very simple XML descriptor.

The newest version!
package org.ibatis.persist.impl.function;

import org.ibatis.persist.impl.CriteriaBuilderImpl;
import org.ibatis.persist.impl.RenderingContext;
import org.ibatis.persist.impl.expression.ExpressionImpl;

/**
 * Models the basic concept of a SQL function.
 */
public class BasicFunctionExpression
		extends ExpressionImpl
		implements FunctionExpression {

	private final String functionName;

	public BasicFunctionExpression(
			CriteriaBuilderImpl criteriaBuilder,
			Class javaType,
			String functionName) {
		super( criteriaBuilder, javaType );
		this.functionName = functionName;
	}

	protected  static int properSize(int number) {
		return number + (int)( number*.75 ) + 1;
	}

	public String getFunctionName() {
		return functionName;
	}

	public boolean isAggregation() {
		return false;
	}

	public void render(RenderingContext rc) {
	    rc.append(getFunctionName()).append("()");
	}

	public void renderProjection(RenderingContext rc) {
	    render(rc);
        if (getAlias() != null) {
            rc.append(" AS ").append(getAlias());
        }
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy