devutility.internal.lang.models.EntityFieldUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devutility.internal Show documentation
Show all versions of devutility.internal Show documentation
Some utilities for Java development
package devutility.internal.lang.models;
import java.util.List;
import devutility.internal.util.CollectionUtils;
public class EntityFieldUtils {
public static List includeEntityFields(List entityFields, List includeFields) {
if (CollectionUtils.isNullOrEmpty(entityFields) || CollectionUtils.isNullOrEmpty(includeFields)) {
return entityFields;
}
return CollectionUtils.list(entityFields, i -> i.getField() != null && includeFields.contains(i.getField().getName()));
}
public static List excludeEntityFields(List entityFields, List excludeFields) {
if (CollectionUtils.isNullOrEmpty(entityFields) || CollectionUtils.isNullOrEmpty(excludeFields)) {
return entityFields;
}
return CollectionUtils.list(entityFields, i -> i.getField() != null && !excludeFields.contains(i.getField().getName()));
}
}