
com.github.alittlehuang.data.query.support.model.FetchAttributeModel Maven / Gradle / Ivy
package com.github.alittlehuang.data.query.support.model;
import com.github.alittlehuang.data.query.specification.AttributePath;
import com.github.alittlehuang.data.query.specification.FetchAttribute;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.criteria.JoinType;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
@Data
@EqualsAndHashCode(callSuper = true)
public class FetchAttributeModel extends AttributePathModel implements FetchAttribute, Serializable {
protected JoinType joinType;
public FetchAttributeModel() {
}
public FetchAttributeModel(AttributePath expression, Class extends T> javaType) {
super(expression, javaType);
}
public static FetchAttributeModel convertFetch(FetchAttribute fetch, Class extends T> javaType) {
FetchAttributeModel result = new FetchAttributeModel<>(fetch, javaType);
result.setJoinType(fetch.getJoinType());
return result;
}
public static List> convertFetch(List extends FetchAttribute> fetch, Class extends T> javaType) {
return fetch.stream().map(i -> convertFetch(i, javaType))
.collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy