mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
Revert "增强ActiveEntity,使其可以使用getter对应的lambda取值或设置条件"
This reverts commit cbebecda58
.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
package cn.hutool.db;
|
||||
|
||||
import cn.hutool.core.lang.func.Func1;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
|
||||
/**
|
||||
* 支持lambda的Entity
|
||||
*
|
||||
* @author VampireAchao
|
||||
*/
|
||||
public class LambdaEntity<T> extends ActiveEntity {
|
||||
|
||||
public LambdaEntity(T entity) {
|
||||
super(parse(entity));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> R get(Func1<T, R> field) {
|
||||
return (R) super.get(LambdaUtil.getFieldName(field));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public LambdaEntity<T> set(Func1<T, ?> field, Object value) {
|
||||
return (LambdaEntity<T>) super.set(LambdaUtil.getFieldName(field), value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public LambdaEntity<T> setIgnoreNull(Func1<T, ?> field, Object value) {
|
||||
if (null != field && null != value) {
|
||||
return (LambdaEntity<T>) set(LambdaUtil.getFieldName(field), value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user