All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 javaType) {
        super(expression, javaType);
    }

    public static  FetchAttributeModel convertFetch(FetchAttribute fetch, Class javaType) {
        FetchAttributeModel result = new FetchAttributeModel<>(fetch, javaType);
        result.setJoinType(fetch.getJoinType());
        return result;
    }

    public static  List> convertFetch(List> fetch, Class javaType) {
        return fetch.stream().map(i -> convertFetch(i, javaType))
                .collect(Collectors.toList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy