[英]What do “.and” and “where” stand for?
I can't understand the following code: 我不明白以下代码:
final Specifications<PaymentBatch> criteriaSpecification =
where(paymentBatchesInZone(getCurrentZone()))
.and(new PaymentBatchSearchFilter(paymentBatchSearchQueryDTO));
What do .and
and where
stand for? 是什么.and
和where
代表什么?
This is a pattern called fluent interface . 这是一种称为流畅接口的模式。
For details see here: Is it bad practice to make a setter return "this"? 有关详细信息,请参见此处: 让二传手返回“ this”是否是错误的做法?
Every call to a function returns the current object so subsequent method calls may be made without having a separate reference declared. 每次对函数的调用都会返回当前对象,因此可以进行后续方法调用而无需声明单独的引用。
Thus both methods where()
and and()
are parts of a DAO pattern and provide the means to create an SQL WHERE
statement. 因此, where()
和and()
这两种方法都是DAO模式的一部分,并提供了创建SQL WHERE
语句的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.