![JAR search and dependency download from the Maven repository](/logo.png)
org.ibatis.persist.impl.expression.ConcatExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbatis Show documentation
Show all versions of jbatis Show documentation
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.expression;
import org.ibatis.persist.criteria.Expression;
import org.ibatis.persist.impl.CriteriaBuilderImpl;
import org.ibatis.persist.impl.Renderable;
import org.ibatis.persist.impl.RenderingContext;
/**
* A string concatenation.
* TODO CONCAT(x, y)
*/
public class ConcatExpression extends ExpressionImpl {
private Expression string1;
private Expression string2;
public ConcatExpression(
CriteriaBuilderImpl criteriaBuilder,
Expression expression1,
Expression expression2) {
super( criteriaBuilder, String.class );
this.string1 = expression1;
this.string2 = expression2;
}
public ConcatExpression(
CriteriaBuilderImpl criteriaBuilder,
Expression string1,
String string2) {
this( criteriaBuilder, string1, wrap( criteriaBuilder, string2) );
}
private static Expression wrap(CriteriaBuilderImpl criteriaBuilder, String string) {
return new LiteralExpression( criteriaBuilder, string );
}
public ConcatExpression(
CriteriaBuilderImpl criteriaBuilder,
String string1,
Expression string2) {
this( criteriaBuilder, wrap( criteriaBuilder, string1), string2 );
}
public Expression getString1() {
return string1;
}
public Expression getString2() {
return string2;
}
public void render(RenderingContext rc) {
((Renderable) getString1()).render(rc);
rc.append(" || ");
((Renderable) getString2()).render(rc);
}
public void renderProjection(RenderingContext rc) {
render(rc);
if (getAlias() != null) {
rc.append(" AS ").append(getAlias());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy