mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Hide constructors
This commit is contained in:
parent
7080a54ffb
commit
39dc0a3ee3
@ -104,6 +104,10 @@ public final class ConstantImpl<T> extends ExpressionBase<T> implements Constant
|
||||
return new ConstantImpl<T>(obj);
|
||||
}
|
||||
|
||||
public static <T> Constant<T> create(Class<T> type, T constant) {
|
||||
return new ConstantImpl<T>(type, constant);
|
||||
}
|
||||
|
||||
private final T constant;
|
||||
|
||||
/**
|
||||
@ -112,7 +116,7 @@ public final class ConstantImpl<T> extends ExpressionBase<T> implements Constant
|
||||
* @param constant constant
|
||||
*/
|
||||
@SuppressWarnings("unchecked") //The class of the constant will mandate the type
|
||||
public ConstantImpl(T constant) {
|
||||
private ConstantImpl(T constant) {
|
||||
this((Class)constant.getClass(), constant);
|
||||
}
|
||||
|
||||
@ -122,7 +126,7 @@ public final class ConstantImpl<T> extends ExpressionBase<T> implements Constant
|
||||
* @param type type of the expression
|
||||
* @param constant constant
|
||||
*/
|
||||
public ConstantImpl(Class<T> type, T constant) {
|
||||
private ConstantImpl(Class<T> type, T constant) {
|
||||
super(type);
|
||||
this.constant = constant;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ object Constants {
|
||||
|
||||
def constant(value: String) = ConstantImpl.create(value)
|
||||
|
||||
def constant[T](value: T) = new ConstantImpl(value)
|
||||
def constant[T](value: T) = ConstantImpl.create(value)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -641,7 +641,7 @@ public final class SQLExpressions {
|
||||
* @return nth_value(expr, n)
|
||||
*/
|
||||
public static <T> WindowOver<T> nthValue(Expression<T> expr, Number n) {
|
||||
return nthValue(expr, new ConstantImpl<Number>(n));
|
||||
return nthValue(expr, ConstantImpl.create(n));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -664,7 +664,7 @@ public final class SQLExpressions {
|
||||
* @return ntile(num)
|
||||
*/
|
||||
public static <T extends Number & Comparable> WindowOver<T> ntile(T num) {
|
||||
return new WindowOver<T>((Class<T>)num.getClass(), SQLOps.NTILE, new ConstantImpl<T>(num));
|
||||
return new WindowOver<T>((Class<T>)num.getClass(), SQLOps.NTILE, ConstantImpl.create(num));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -800,7 +800,7 @@ public final class SQLExpressions {
|
||||
if (arg.doubleValue() < 0.0 || arg.doubleValue() > 1.0) {
|
||||
throw new IllegalArgumentException("The percentile value should be a number between 0 and 1");
|
||||
}
|
||||
return percentileCont(new ConstantImpl<T>(arg));
|
||||
return percentileCont(ConstantImpl.create(arg));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -829,7 +829,7 @@ public final class SQLExpressions {
|
||||
if (arg.doubleValue() < 0.0 || arg.doubleValue() > 1.0) {
|
||||
throw new IllegalArgumentException("The percentile value should be a number between 0 and 1");
|
||||
}
|
||||
return percentileDisc(new ConstantImpl<T>(arg));
|
||||
return percentileDisc(ConstantImpl.create(arg));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user