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

graphql.validation.ErrorFactory Maven / Gradle / Ivy

package graphql.validation;


import graphql.language.Node;
import graphql.language.SourceLocation;

import java.util.ArrayList;
import java.util.List;

public class ErrorFactory {


    public ValidationError newError(ValidationErrorType validationErrorType, List locations, String description) {
        List locationList = new ArrayList<>();
        for (Node node : locations) {
            locationList.add(node.getSourceLocation());
        }
        return new ValidationError(validationErrorType, locationList, description);
    }

    public ValidationError newError(ValidationErrorType validationErrorType, String description) {
        return new ValidationError(validationErrorType, (List) null, description);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy