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

com.jparams.object.builder.Build Maven / Gradle / Ivy

package com.jparams.object.builder;

import java.util.List;
import java.util.stream.Collectors;

import com.jparams.object.builder.issue.Issue;
import com.jparams.object.builder.issue.IssueType;
import com.jparams.object.builder.utils.CollectionUtils;

public class Build
{
    private final T obj;
    private final List issues;

    public Build(final T obj, final List issues)
    {
        this.obj = obj;
        this.issues = CollectionUtils.unmodifiableCopy(issues);
    }

    public T get()
    {
        return obj;
    }

    public List getIssues()
    {
        return issues;
    }

    public List getErrors()
    {
        return issues.stream()
                     .filter(issue -> issue.getIssueType() == IssueType.ERROR)
                     .collect(Collectors.toList());
    }

    public List getWarnings()
    {
        return issues.stream()
                     .filter(issue -> issue.getIssueType() == IssueType.WARNING)
                     .collect(Collectors.toList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy