本文整理汇总了Java中com.mysema.query.support.Expressions.constant方法的典型用法代码示例。如果您正苦于以下问题:Java Expressions.constant方法的具体用法?Java Expressions.constant怎么用?Java Expressions.constant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.support.Expressions
的用法示例。
在下文中一共展示了Expressions.constant方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: QAuthor
import com.mysema.query.support.Expressions; //导入方法依赖的package包/类
@Test
public void sec020201_定数値をカラムとして照会する() {
Expression<Integer> const1 = Expressions.constant(1);
Expression<String> const2 = Expressions.constant("string");
QAuthor a = new QAuthor("a");
SQLQuery query = queryDslJdbcOperations.newSqlQuery();
query.from(a);
List<Tuple> list = queryDslJdbcOperations.query(query, new QTuple(a.id,
const1, const2));
for (Tuple tuple : list) {
Long valId = tuple.get(a.id);
Integer valConst1 = tuple.get(const1);
String valConst2 = tuple.get(const2);
out.println(format("{0}: const1={1}, const2={2}", valId, valConst1,
valConst2));
}
}
示例2: executeGetDatasetStatus
import com.mysema.query.support.Expressions; //导入方法依赖的package包/类
private Object executeGetDatasetStatus(GetDatasetStatus query) {
SQLQuery baseQuery = query().from(datasetStatus)
.join(dataset).on(dataset.id.eq(datasetStatus.id));
Expression<DatasetStatusInfo> expression =
new QDatasetStatusInfo(
dataset.identification,
datasetStatus.columnsChanged,
datasetStatus.filterConditionChanged,
datasetStatus.sourceDatasetChanged,
datasetStatus.imported,
Expressions.constant(false),
datasetStatus.sourceDatasetColumnsChanged,
datasetStatus.sourceDatasetRevisionChanged);
String datasourceId = query.getDatasetId();
if(datasourceId == null) {
return new TypedList<>(
DatasetStatusInfo.class,
baseQuery.list(expression));
} else {
return
baseQuery.where(dataset.identification.eq(datasourceId))
.singleResult(expression);
}
}
示例3: constExpression
import com.mysema.query.support.Expressions; //导入方法依赖的package包/类
private <T> Expression<T> constExpression(T value) {
if(value instanceof Serializable) {
return Expressions.constant(value);
} else {
throw new IllegalArgumentException("value is not serializable");
}
}
示例4: asExpressions
import com.mysema.query.support.Expressions; //导入方法依赖的package包/类
private Expression<?>[] asExpressions(Object... args) {
Expression<?>[] exprArgs = new Expression<?>[args.length];
int i = 0;
for(Object arg : args) {
if(arg instanceof Expression) {
exprArgs[i++] = (Expression<?>)arg;
} else {
exprArgs[i++] = Expressions.constant(arg);
}
}
return exprArgs;
}