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

graphql.servlet.internal.GraphQLRequest Maven / Gradle / Ivy

There is a newer version: 16.0.0
Show newest version
package graphql.servlet.internal;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Andrew Potter
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class GraphQLRequest {
    private String query;
    @JsonDeserialize(using = VariablesDeserializer.class)
    private Map variables = new HashMap<>();
    private String operationName;

    public GraphQLRequest() {
    }

    public GraphQLRequest(String query, Map variables, String operationName) {
        this.query = query;
        this.operationName = operationName;
        if (variables != null) {
            this.variables = variables;
        }
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public Map getVariables() {
        return variables;
    }

    public void setVariables(Map variables) {
        if (variables != null) {
            this.variables = variables;
        }
    }

    public String getOperationName() {
        if (operationName != null && !operationName.isEmpty()) {
            return operationName;
        }

        return null;
    }

    public void setOperationName(String operationName) {
        this.operationName = operationName;
    }
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy