EJB-447 : Implement JPA 2.0 criteria apis (completed function support)
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17251 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
f6665eccba
commit
3175437151
|
@ -41,10 +41,25 @@ import javax.persistence.criteria.Subquery;
|
|||
import javax.persistence.Tuple;
|
||||
|
||||
import org.hibernate.ejb.EntityManagerFactoryImpl;
|
||||
import org.hibernate.ejb.criteria.expression.BinaryArithmeticOperation;
|
||||
import org.hibernate.ejb.criteria.expression.CompoundSelectionImpl;
|
||||
import org.hibernate.ejb.criteria.expression.ParameterExpressionImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
import org.hibernate.ejb.criteria.expression.SubqueryComparisonModifierExpression;
|
||||
import org.hibernate.ejb.criteria.expression.UnaryArithmeticOperation;
|
||||
import org.hibernate.ejb.criteria.expression.function.AbsFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.AggregationFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.BasicFunctionExpression;
|
||||
import org.hibernate.ejb.criteria.expression.function.CurrentDateFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.CurrentTimeFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.CurrentTimestampFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.LengthFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.LocateFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.LowerFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.SqrtFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.SubstringFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.TrimFunction;
|
||||
import org.hibernate.ejb.criteria.expression.function.UpperFunction;
|
||||
import org.hibernate.ejb.criteria.predicate.BooleanExpressionPredicate;
|
||||
import org.hibernate.ejb.criteria.predicate.ExplicitTruthValueCheck;
|
||||
import org.hibernate.ejb.criteria.predicate.TruthValue;
|
||||
|
@ -53,6 +68,7 @@ import org.hibernate.ejb.criteria.predicate.CompoundPredicate;
|
|||
import org.hibernate.ejb.criteria.predicate.ComparisonPredicate;
|
||||
import org.hibernate.ejb.criteria.predicate.InPredicate;
|
||||
import org.hibernate.ejb.criteria.predicate.BetweenPredicate;
|
||||
import org.hibernate.ejb.criteria.predicate.LikePredicate;
|
||||
import static org.hibernate.ejb.criteria.predicate.ComparisonPredicate.ComparisonOperator;
|
||||
|
||||
/**
|
||||
|
@ -519,6 +535,54 @@ public class QueryBuilderImpl implements QueryBuilder, Serializable {
|
|||
return new InPredicate<T>( this, expression, values );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, Expression<String> pattern) {
|
||||
return new LikePredicate( this, matchExpression, pattern );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, Expression<String> pattern, Expression<Character> escapeCharacter) {
|
||||
return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, Expression<String> pattern, char escapeCharacter) {
|
||||
return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, String pattern) {
|
||||
return new LikePredicate( this, matchExpression, pattern );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, String pattern, Expression<Character> escapeCharacter) {
|
||||
return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> matchExpression, String pattern, char escapeCharacter) {
|
||||
return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern) {
|
||||
return like( matchExpression, pattern ).negate();
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern, Expression<Character> escapeCharacter) {
|
||||
return like( matchExpression, pattern, escapeCharacter ).negate();
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern, char escapeCharacter) {
|
||||
return like( matchExpression, pattern, escapeCharacter ).negate();
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, String pattern) {
|
||||
return like( matchExpression, pattern ).negate();
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, String pattern, Expression<Character> escapeCharacter) {
|
||||
return like( matchExpression, pattern, escapeCharacter ).negate();
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> matchExpression, String pattern, char escapeCharacter) {
|
||||
return like( matchExpression, pattern, escapeCharacter ).negate();
|
||||
}
|
||||
|
||||
|
||||
// parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -603,126 +667,406 @@ public class QueryBuilderImpl implements QueryBuilder, Serializable {
|
|||
}
|
||||
|
||||
|
||||
// other functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <T> Expression<T> function(String name, Class<T> returnType, Expression<?>... arguments) {
|
||||
return new BasicFunctionExpression<T>( this, returnType, name, arguments );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> abs(Expression<N> expression) {
|
||||
return new AbsFunction<N>( this, expression );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Double> sqrt(Expression<? extends Number> expression) {
|
||||
return new SqrtFunction( this, expression );
|
||||
}
|
||||
|
||||
public Expression<java.sql.Date> currentDate() {
|
||||
return new CurrentDateFunction( this );
|
||||
}
|
||||
|
||||
public Expression<java.sql.Timestamp> currentTimestamp() {
|
||||
return new CurrentTimestampFunction( this );
|
||||
}
|
||||
|
||||
public Expression<java.sql.Time> currentTime() {
|
||||
return new CurrentTimeFunction( this );
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> value, Expression<Integer> start) {
|
||||
return new SubstringFunction( this, value, start );
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> value, int start) {
|
||||
return new SubstringFunction( this, value, start );
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> value, Expression<Integer> start, Expression<Integer> length) {
|
||||
return new SubstringFunction( this, value, start, length );
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> value, int start, int length) {
|
||||
return new SubstringFunction( this, value, start, length );
|
||||
}
|
||||
|
||||
public Expression<String> trim(Expression<String> trimSource ) {
|
||||
return new TrimFunction( this, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, Expression<String> trimSource) {
|
||||
return new TrimFunction( this, trimspec, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> trim(Expression<Character> trimCharacter, Expression<String> trimSource) {
|
||||
return new TrimFunction( this, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, Expression<Character> trimCharacter, Expression<String> trimSource) {
|
||||
return new TrimFunction( this, trimspec, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> trim(char trimCharacter, Expression<String> trimSource) {
|
||||
return new TrimFunction( this, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, char trimCharacter, Expression<String> trimSource) {
|
||||
return new TrimFunction( this, trimspec, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public Expression<String> lower(Expression<String> value) {
|
||||
return new LowerFunction( this, value );
|
||||
}
|
||||
|
||||
public Expression<String> upper(Expression<String> value) {
|
||||
return new UpperFunction( this, value );
|
||||
}
|
||||
|
||||
public Expression<Integer> length(Expression<String> value) {
|
||||
return new LengthFunction( this, value );
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> string, Expression<String> pattern) {
|
||||
return new LocateFunction( this, pattern, string );
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> string, Expression<String> pattern, Expression<Integer> start) {
|
||||
return new LocateFunction( this, pattern, string, start );
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> string, String pattern) {
|
||||
return new LocateFunction( this, pattern, string );
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> string, String pattern, int start) {
|
||||
return new LocateFunction( this, pattern, string, start );
|
||||
}
|
||||
|
||||
|
||||
// arithmetic operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> neg(Expression<N> expression) {
|
||||
return new UnaryArithmeticOperation<N>(
|
||||
this,
|
||||
UnaryArithmeticOperation.Operation.UNARY_MINUS,
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> sum(Expression<? extends N> expression1, Expression<? extends N> expression2) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression1.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.ADD,
|
||||
expression1,
|
||||
expression2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> prod(Expression<? extends N> expression1, Expression<? extends N> expression2) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression1.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.MULTIPLY,
|
||||
expression1,
|
||||
expression2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> diff(Expression<? extends N> expression1, Expression<? extends N> expression2) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression1.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.SUBTRACT,
|
||||
expression1,
|
||||
expression2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> sum(Expression<? extends N> expression, N n) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.ADD,
|
||||
expression,
|
||||
n
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> prod(Expression<? extends N> expression, N n) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.MULTIPLY,
|
||||
expression,
|
||||
n
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> diff(Expression<? extends N> expression, N n) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.SUBTRACT,
|
||||
expression,
|
||||
n
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> sum(N n, Expression<? extends N> expression) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.ADD,
|
||||
n,
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> prod(N n, Expression<? extends N> expression) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.MULTIPLY,
|
||||
n,
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <N extends Number> Expression<N> diff(N n, Expression<? extends N> expression) {
|
||||
return new BinaryArithmeticOperation<N>(
|
||||
this,
|
||||
(Class<N>) expression.getJavaType(),
|
||||
BinaryArithmeticOperation.Operation.SUBTRACT,
|
||||
n,
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Number> quot(Expression<? extends Number> expression1, Expression<? extends Number> expression2) {
|
||||
// TODO : still open question whether this should be a quotient (integer division) or division
|
||||
throw new UnsupportedOperationException( "Not yet implemented!" );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Number> quot(Expression<? extends Number> expression, Number number) {
|
||||
// TODO : still open question whether this should be a quotient (integer division) or division
|
||||
throw new UnsupportedOperationException( "Not yet implemented!" );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Number> quot(Number number, Expression<? extends Number> expression) {
|
||||
// TODO : still open question whether this should be a quotient (integer division) or division
|
||||
throw new UnsupportedOperationException( "Not yet implemented!" );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Integer> mod(Expression<Integer> expression1, Expression<Integer> expression2) {
|
||||
return new BinaryArithmeticOperation<Integer>(
|
||||
this,
|
||||
Integer.class,
|
||||
BinaryArithmeticOperation.Operation.MOD,
|
||||
expression1,
|
||||
expression2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Integer> mod(Expression<Integer> expression, Integer integer) {
|
||||
return new BinaryArithmeticOperation<Integer>(
|
||||
this,
|
||||
Integer.class,
|
||||
BinaryArithmeticOperation.Operation.MOD,
|
||||
expression,
|
||||
integer
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Integer> mod(Integer integer, Expression<Integer> expression) {
|
||||
return new BinaryArithmeticOperation<Integer>(
|
||||
this,
|
||||
Integer.class,
|
||||
BinaryArithmeticOperation.Operation.MOD,
|
||||
integer,
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// casting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Long> toLong(Expression<? extends Number> expression) {
|
||||
return expression.as( Long.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Integer> toInteger(Expression<? extends Number> expression) {
|
||||
return expression.as( Integer.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Float> toFloat(Expression<? extends Number> expression) {
|
||||
return expression.as( Float.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<Double> toDouble(Expression<? extends Number> expression) {
|
||||
return expression.as( Double.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
|
||||
return expression.as( BigDecimal.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<BigInteger> toBigInteger(Expression<? extends Number> expression) {
|
||||
return expression.as( BigInteger.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Expression<String> toString(Expression<Character> characterExpression) {
|
||||
return characterExpression.as( String.class );
|
||||
}
|
||||
|
||||
|
||||
// subqueries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Predicate exists(Subquery<?> subquery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <Y> Expression<Y> all(Subquery<Y> ySubquery) {
|
||||
return null;
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <Y> Expression<Y> all(Subquery<Y> subquery) {
|
||||
return new SubqueryComparisonModifierExpression<Y>(
|
||||
this,
|
||||
subquery.getJavaType(),
|
||||
subquery,
|
||||
SubqueryComparisonModifierExpression.Modifier.ALL
|
||||
);
|
||||
}
|
||||
|
||||
public <Y> Expression<Y> some(Subquery<Y> ySubquery) {
|
||||
return null;
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <Y> Expression<Y> some(Subquery<Y> subquery) {
|
||||
return new SubqueryComparisonModifierExpression<Y>(
|
||||
this,
|
||||
subquery.getJavaType(),
|
||||
subquery,
|
||||
SubqueryComparisonModifierExpression.Modifier.SOME
|
||||
);
|
||||
}
|
||||
|
||||
public <Y> Expression<Y> any(Subquery<Y> ySubquery) {
|
||||
return null;
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <Y> Expression<Y> any(Subquery<Y> subquery) {
|
||||
return new SubqueryComparisonModifierExpression<Y>(
|
||||
this,
|
||||
subquery.getJavaType(),
|
||||
subquery,
|
||||
SubqueryComparisonModifierExpression.Modifier.ANY
|
||||
);
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> neg(Expression<N> nExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> abs(Expression<N> nExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> sum(Expression<? extends N> expression, Expression<? extends N> expression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> prod(Expression<? extends N> expression, Expression<? extends N> expression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> diff(Expression<? extends N> expression, Expression<? extends N> expression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> sum(Expression<? extends N> expression, N n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> prod(Expression<? extends N> expression, N n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> diff(Expression<? extends N> expression, N n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> sum(N n, Expression<? extends N> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> prod(N n, Expression<? extends N> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <N extends Number> Expression<N> diff(N n, Expression<? extends N> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Number> quot(Expression<? extends Number> expression, Expression<? extends Number> expression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Number> quot(Expression<? extends Number> expression, Number number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Number> quot(Number number, Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> mod(Expression<Integer> integerExpression, Expression<Integer> integerExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> mod(Expression<Integer> integerExpression, Integer integer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> mod(Integer integer, Expression<Integer> integerExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Double> sqrt(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Long> toLong(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> toInteger(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Float> toFloat(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Double> toDouble(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<BigInteger> toBigInteger(Expression<? extends Number> expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> toString(Expression<Character> characterExpression) {
|
||||
return null;
|
||||
}
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
public <C extends Collection<?>> Predicate isEmpty(Expression<C> cExpression) {
|
||||
return null;
|
||||
|
@ -764,54 +1108,6 @@ public class QueryBuilderImpl implements QueryBuilder, Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Character> characterExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1, char c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, String s, Expression<Character> characterExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate like(Expression<String> stringExpression, String s, char c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Character> characterExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1, char c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, String s, Expression<Character> characterExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Predicate notLike(Expression<String> stringExpression, String s, char c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> concat(Expression<String> stringExpression, Expression<String> stringExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
@ -824,86 +1120,6 @@ public class QueryBuilderImpl implements QueryBuilder, Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> stringExpression, Expression<Integer> integerExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> stringExpression, int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> stringExpression, Expression<Integer> integerExpression, Expression<Integer> integerExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> substring(Expression<String> stringExpression, int i, int i1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(Expression<Character> characterExpression, Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, Expression<Character> characterExpression, Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(char c, Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> trim(Trimspec trimspec, char c, Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> lower(Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<String> upper(Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> length(Expression<String> stringExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> stringExpression, Expression<String> stringExpression1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Integer> integerExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> stringExpression, String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<Integer> locate(Expression<String> stringExpression, String s, int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<java.sql.Date> currentDate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<java.sql.Timestamp> currentTimestamp() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Expression<java.sql.Time> currentTime() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <Y> Expression<Y> coalesce(Expression<? extends Y> expression, Expression<? extends Y> expression1) {
|
||||
return null;
|
||||
}
|
||||
|
@ -931,8 +1147,4 @@ public class QueryBuilderImpl implements QueryBuilder, Serializable {
|
|||
public <R> Case<R> selectCase() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> Expression<T> function(String s, Class<T> tClass, Expression<?>... expressions) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models standard arithmetc operations with two operands.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BinaryArithmeticOperation<N extends Number>
|
||||
extends ExpressionImpl<N>
|
||||
implements BinaryOperatorExpression<N> {
|
||||
|
||||
public static enum Operation {
|
||||
ADD, SUBTRACT, MULTIPLY, DIVIDE, QUOT, MOD
|
||||
}
|
||||
|
||||
private final Operation operator;
|
||||
private final Expression<? extends N> rhs;
|
||||
private final Expression<? extends N> lhs;
|
||||
|
||||
public BinaryArithmeticOperation(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<N> javaType,
|
||||
Operation operator,
|
||||
Expression<? extends N> rhs,
|
||||
Expression<? extends N> lhs) {
|
||||
super( queryBuilder, javaType );
|
||||
this.operator = operator;
|
||||
this.rhs = rhs;
|
||||
this.lhs = lhs;
|
||||
}
|
||||
|
||||
public BinaryArithmeticOperation(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<N> javaType,
|
||||
Operation operator,
|
||||
Expression<? extends N> rhs,
|
||||
N lhs) {
|
||||
super( queryBuilder, javaType );
|
||||
this.operator = operator;
|
||||
this.rhs = rhs;
|
||||
this.lhs = new LiteralExpression<N>( queryBuilder, lhs );
|
||||
}
|
||||
|
||||
public BinaryArithmeticOperation(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<N> javaType,
|
||||
Operation operator,
|
||||
N rhs,
|
||||
Expression<? extends N> lhs) {
|
||||
super( queryBuilder, javaType );
|
||||
this.operator = operator;
|
||||
this.rhs = new LiteralExpression<N>( queryBuilder, rhs );
|
||||
this.lhs = lhs;
|
||||
}
|
||||
|
||||
public Operation getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public Expression<? extends N> getRightHandOperand() {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
public Expression<? extends N> getLeftHandOperand() {
|
||||
return lhs;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
|
||||
/**
|
||||
* Contract for operators with two operands.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface BinaryOperatorExpression<T> extends Expression<T> {
|
||||
/**
|
||||
* Get the right-hand operand.
|
||||
*
|
||||
* @return The right-hand operand.
|
||||
*/
|
||||
public Expression<?> getRightHandOperand();
|
||||
|
||||
/**
|
||||
* Get the left-hand operand.
|
||||
*
|
||||
* @return The left-hand operand.
|
||||
*/
|
||||
public Expression<?> getLeftHandOperand();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.hibernate.ejb.criteria.expression;
|
||||
|
||||
import javax.persistence.criteria.Subquery;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Represents a {@link Modifier#ALL}, {@link Modifier#ANY}, {@link Modifier#SOME} modifier appplied to a subquery as
|
||||
* part of a comparison.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SubqueryComparisonModifierExpression<Y> extends ExpressionImpl<Y> {
|
||||
public static enum Modifier { ALL, SOME, ANY };
|
||||
|
||||
private final Subquery<Y> subquery;
|
||||
private final Modifier modifier;
|
||||
|
||||
public SubqueryComparisonModifierExpression(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<Y> javaType,
|
||||
Subquery<Y> subquery,
|
||||
Modifier modifier) {
|
||||
super(queryBuilder, javaType);
|
||||
this.subquery = subquery;
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public Modifier getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public Subquery<Y> getSubquery() {
|
||||
return subquery;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.hibernate.ejb.criteria.expression;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models arithmetc operations with two operands.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class UnaryArithmeticOperation<T>
|
||||
extends ExpressionImpl<T>
|
||||
implements UnaryOperatorExpression<T> {
|
||||
|
||||
public static enum Operation {
|
||||
UNARY_PLUS, UNARY_MINUS
|
||||
}
|
||||
|
||||
private final Operation operation;
|
||||
private final Expression<T> operand;
|
||||
|
||||
public UnaryArithmeticOperation(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Operation operation,
|
||||
Expression<T> operand) {
|
||||
super( queryBuilder, operand.getJavaType() );
|
||||
this.operation = operation;
|
||||
this.operand = operand;
|
||||
}
|
||||
|
||||
public Expression<T> getOperand() {
|
||||
return operand;
|
||||
}
|
||||
|
||||
public Operation getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
|
||||
/**
|
||||
* Contract for operators with a single operand.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface UnaryOperatorExpression<T> extends Expression<T> {
|
||||
/**
|
||||
* Get the operand.
|
||||
*
|
||||
* @return The operand.
|
||||
*/
|
||||
public Expression<?> getOperand();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>ABS</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AbsFunction<N extends Number>
|
||||
extends BasicFunctionExpression<N> {
|
||||
|
||||
public static final String NAME = "abs";
|
||||
|
||||
public AbsFunction(QueryBuilderImpl queryBuilder, Expression<N> expression) {
|
||||
super( queryBuilder, expression.getJavaType(), NAME, expression );
|
||||
}
|
||||
}
|
|
@ -1,7 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
|
@ -12,8 +31,6 @@ import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AggregationFunction<T> extends BasicFunctionExpression<T> {
|
||||
private static final List<Expression<?>> NO_ARGS = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* Constructs an aggregation function with no arguments (<tt>COUNT(*)</tt> e.g.).
|
||||
*
|
||||
|
|
|
@ -25,19 +25,32 @@ import java.util.ArrayList;
|
|||
import org.hibernate.ejb.criteria.expression.*;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import javax.persistence.criteria.Expression;
|
||||
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
* Models the basic conept of a SQL function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BasicFunctionExpression<X> extends ExpressionImpl<X> implements FunctionExpression<X> {
|
||||
public class BasicFunctionExpression<X>
|
||||
extends ExpressionImpl<X>
|
||||
implements FunctionExpression<X> {
|
||||
|
||||
public static final List<Expression<?>> NO_ARGS = Collections.emptyList();
|
||||
|
||||
private final String functionName;
|
||||
private final List<Expression<?>> argumentExpressions;
|
||||
|
||||
public BasicFunctionExpression(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<X> javaType,
|
||||
String functionName) {
|
||||
this( queryBuilder, javaType, functionName, NO_ARGS );
|
||||
}
|
||||
|
||||
public BasicFunctionExpression(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Class<X> javaType,
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>CURRENT_DATE</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CurrentDateFunction extends BasicFunctionExpression<java.sql.Date> {
|
||||
public static final String NAME = "current_date";
|
||||
|
||||
public CurrentDateFunction(QueryBuilderImpl queryBuilder) {
|
||||
super( queryBuilder, java.sql.Date.class, NAME );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>CURRENT_TIME</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CurrentTimeFunction extends BasicFunctionExpression<java.sql.Time> {
|
||||
public static final String NAME = "current_time";
|
||||
|
||||
public CurrentTimeFunction(QueryBuilderImpl queryBuilder) {
|
||||
super( queryBuilder, java.sql.Time.class, NAME );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>CURRENT_TIMESTAMP</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CurrentTimestampFunction extends BasicFunctionExpression<Timestamp> {
|
||||
public static final String NAME = "current_timestamp";
|
||||
|
||||
public CurrentTimestampFunction(QueryBuilderImpl queryBuilder) {
|
||||
super( queryBuilder, Timestamp.class, NAME );
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ package org.hibernate.ejb.criteria.expression.function;
|
|||
import javax.persistence.criteria.Expression;
|
||||
|
||||
/**
|
||||
* Models an expression resolved as a SQL function call.
|
||||
* Contract for expressions which model a SQL function call.
|
||||
*
|
||||
* @param <T> The type of the function result.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>LENGTH</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LengthFunction extends BasicFunctionExpression<Integer> {
|
||||
public static final String NAME = "length";
|
||||
|
||||
public LengthFunction(QueryBuilderImpl queryBuilder, Expression<String> value) {
|
||||
super( queryBuilder, Integer.class, NAME, value );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>LOCATE</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LocateFunction extends BasicFunctionExpression<Integer> {
|
||||
public static final String NAME = "locate";
|
||||
|
||||
private final Expression<String> pattern;
|
||||
private final Expression<String> string;
|
||||
private final Expression<Integer> start;
|
||||
|
||||
public LocateFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> pattern,
|
||||
Expression<String> string,
|
||||
Expression<Integer> start) {
|
||||
super( queryBuilder, Integer.class, NAME );
|
||||
this.pattern = pattern;
|
||||
this.string = string;
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public LocateFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> pattern,
|
||||
Expression<String> string) {
|
||||
this( queryBuilder, pattern, string, null );
|
||||
}
|
||||
|
||||
public LocateFunction(QueryBuilderImpl queryBuilder, String pattern, Expression<String> string) {
|
||||
this(
|
||||
queryBuilder,
|
||||
new LiteralExpression<String>( queryBuilder, pattern ),
|
||||
string,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
public LocateFunction(QueryBuilderImpl queryBuilder, String pattern, Expression<String> string, int start) {
|
||||
this(
|
||||
queryBuilder,
|
||||
new LiteralExpression<String>( queryBuilder, pattern ),
|
||||
string,
|
||||
new LiteralExpression<Integer>( queryBuilder, start )
|
||||
);
|
||||
}
|
||||
|
||||
public Expression<String> getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public Expression<Integer> getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public Expression<String> getString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>LOWER</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LowerFunction extends BasicFunctionExpression<String> {
|
||||
public static final String NAME = "lower";
|
||||
|
||||
public LowerFunction(QueryBuilderImpl queryBuilder, Expression<String> string) {
|
||||
super( queryBuilder, String.class, NAME, string );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>SQRT</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SqrtFunction extends BasicFunctionExpression<Double> {
|
||||
public static final String NAME = "sqrt";
|
||||
|
||||
public SqrtFunction(QueryBuilderImpl queryBuilder, Expression<? extends Number> expression) {
|
||||
super( queryBuilder, Double.class, NAME, expression );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>SUBSTRING</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SubstringFunction extends BasicFunctionExpression<String> {
|
||||
public static final String NAME = "substring";
|
||||
|
||||
private final Expression<String> value;
|
||||
private final Expression<Integer> start;
|
||||
private final Expression<Integer> length;
|
||||
|
||||
public SubstringFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> value,
|
||||
Expression<Integer> start,
|
||||
Expression<Integer> length) {
|
||||
super( queryBuilder, String.class, NAME );
|
||||
this.value = value;
|
||||
this.start = start;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public SubstringFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> value,
|
||||
Expression<Integer> start) {
|
||||
this( queryBuilder, value, start, (Expression<Integer>)null );
|
||||
}
|
||||
|
||||
public SubstringFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> value,
|
||||
int start) {
|
||||
this(
|
||||
queryBuilder,
|
||||
value,
|
||||
new LiteralExpression<Integer>( queryBuilder, start )
|
||||
);
|
||||
}
|
||||
|
||||
public SubstringFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> value,
|
||||
int start,
|
||||
int length) {
|
||||
this(
|
||||
queryBuilder,
|
||||
value,
|
||||
new LiteralExpression<Integer>( queryBuilder, start ),
|
||||
new LiteralExpression<Integer>( queryBuilder, length )
|
||||
);
|
||||
}
|
||||
|
||||
public Expression<Integer> getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public Expression<Integer> getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public Expression<String> getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import javax.persistence.criteria.QueryBuilder.Trimspec;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>TRIM</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TrimFunction extends BasicFunctionExpression<String> {
|
||||
public static final String NAME = "trim";
|
||||
public static final Trimspec DEFAULT_TRIMSPEC = Trimspec.BOTH;
|
||||
public static final char DEFAULT_TRIM_CHAR = ' ';
|
||||
|
||||
private final Trimspec trimspec;
|
||||
private final Expression<Character> trimCharacter;
|
||||
private final Expression<String> trimSource;
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Trimspec trimspec,
|
||||
Expression<Character> trimCharacter,
|
||||
Expression<String> trimSource) {
|
||||
super( queryBuilder, String.class, NAME );
|
||||
this.trimspec = trimspec;
|
||||
this.trimCharacter = trimCharacter;
|
||||
this.trimSource = trimSource;
|
||||
}
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Trimspec trimspec,
|
||||
char trimCharacter,
|
||||
Expression<String> trimSource) {
|
||||
super( queryBuilder, String.class, NAME );
|
||||
this.trimspec = trimspec;
|
||||
this.trimCharacter = new LiteralExpression<Character>( queryBuilder, trimCharacter );
|
||||
this.trimSource = trimSource;
|
||||
}
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> trimSource) {
|
||||
this( queryBuilder, DEFAULT_TRIMSPEC, DEFAULT_TRIM_CHAR, trimSource );
|
||||
}
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<Character> trimCharacter,
|
||||
Expression<String> trimSource) {
|
||||
this( queryBuilder, DEFAULT_TRIMSPEC, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
char trimCharacter,
|
||||
Expression<String> trimSource) {
|
||||
this( queryBuilder, DEFAULT_TRIMSPEC, trimCharacter, trimSource );
|
||||
}
|
||||
|
||||
public TrimFunction(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Trimspec trimspec,
|
||||
Expression<String> trimSource) {
|
||||
this( queryBuilder, trimspec, DEFAULT_TRIM_CHAR, trimSource );
|
||||
}
|
||||
|
||||
public Expression<Character> getTrimCharacter() {
|
||||
return trimCharacter;
|
||||
}
|
||||
|
||||
public Expression<String> getTrimSource() {
|
||||
return trimSource;
|
||||
}
|
||||
|
||||
public Trimspec getTrimspec() {
|
||||
return trimspec;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.expression.function;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL <tt>UPPER</tt> function.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class UpperFunction extends BasicFunctionExpression<String> {
|
||||
public static final String NAME = "upper";
|
||||
|
||||
public UpperFunction(QueryBuilderImpl queryBuilder, Expression<String> string) {
|
||||
super( queryBuilder, String.class, NAME, string );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.ejb.criteria.predicate;
|
||||
|
||||
import javax.persistence.criteria.Expression;
|
||||
import org.hibernate.ejb.criteria.QueryBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.expression.LiteralExpression;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LikePredicate extends AbstractSimplePredicate {
|
||||
private final Expression<String> matchExpression;
|
||||
private final Expression<String> pattern;
|
||||
private final Expression<Character> escapeCharacter;
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
Expression<String> pattern) {
|
||||
this( queryBuilder, matchExpression, pattern, null );
|
||||
}
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
String pattern) {
|
||||
this( queryBuilder, matchExpression, new LiteralExpression<String>( queryBuilder, pattern) );
|
||||
}
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
Expression<String> pattern,
|
||||
Expression<Character> escapeCharacter) {
|
||||
super( queryBuilder );
|
||||
this.matchExpression = matchExpression;
|
||||
this.pattern = pattern;
|
||||
this.escapeCharacter = escapeCharacter;
|
||||
}
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
Expression<String> pattern,
|
||||
char escapeCharacter) {
|
||||
this(
|
||||
queryBuilder,
|
||||
matchExpression,
|
||||
pattern,
|
||||
new LiteralExpression<Character>( queryBuilder, escapeCharacter )
|
||||
);
|
||||
}
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
String pattern,
|
||||
char escapeCharacter) {
|
||||
this(
|
||||
queryBuilder,
|
||||
matchExpression,
|
||||
new LiteralExpression<String>( queryBuilder, pattern ),
|
||||
new LiteralExpression<Character>( queryBuilder, escapeCharacter )
|
||||
);
|
||||
}
|
||||
|
||||
public LikePredicate(
|
||||
QueryBuilderImpl queryBuilder,
|
||||
Expression<String> matchExpression,
|
||||
String pattern,
|
||||
Expression<Character> escapeCharacter) {
|
||||
this(
|
||||
queryBuilder,
|
||||
matchExpression,
|
||||
new LiteralExpression<String>( queryBuilder, pattern ),
|
||||
escapeCharacter
|
||||
);
|
||||
}
|
||||
|
||||
public Expression<Character> getEscapeCharacter() {
|
||||
return escapeCharacter;
|
||||
}
|
||||
|
||||
public Expression<String> getMatchExpression() {
|
||||
return matchExpression;
|
||||
}
|
||||
|
||||
public Expression<String> getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue