com.github.wz2cool.dynamic.model.SelectPropertyConfig Maven / Gradle / Ivy
package com.github.wz2cool.dynamic.model;
import com.github.wz2cool.dynamic.helper.CommonsHelper;
import com.github.wz2cool.dynamic.lambda.GetCommonPropertyFunction;
import java.util.HashSet;
import java.util.Set;
public class SelectPropertyConfig {
private final Set selectPropertyNames = new HashSet<>();
private final Set ignorePropertyNames = new HashSet<>();
public Set getSelectPropertyNames() {
return selectPropertyNames;
}
public Set getIgnorePropertyNames() {
return ignorePropertyNames;
}
@SafeVarargs
public final SelectPropertyConfig select(boolean enable, GetCommonPropertyFunction... getCommonPropertyFuncs) {
for (GetCommonPropertyFunction getCommonPropertyFunc : getCommonPropertyFuncs) {
final String propertyName = CommonsHelper.getPropertyName(getCommonPropertyFunc);
selectPropertyNames.add(propertyName);
}
return this;
}
@SafeVarargs
public final SelectPropertyConfig select(GetCommonPropertyFunction... getCommonPropertyFuncs) {
return select(true, getCommonPropertyFuncs);
}
@SafeVarargs
public final SelectPropertyConfig ignore(boolean enable, GetCommonPropertyFunction... getCommonPropertyFuncs) {
for (GetCommonPropertyFunction getCommonPropertyFunc : getCommonPropertyFuncs) {
final String propertyName = CommonsHelper.getPropertyName(getCommonPropertyFunc);
ignorePropertyNames.add(propertyName);
}
return this;
}
@SafeVarargs
public final SelectPropertyConfig ignore(GetCommonPropertyFunction... getCommonPropertyFuncs) {
return ignore(true, getCommonPropertyFuncs);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy