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

com.starksign.error.InputErrors Maven / Gradle / Ivy

Go to download

Welcome to the Stark Sign Java SDK! This tool is made for Java developers who want to easily integrate with our API. This SDK version is compatible with the Stark Sign API v2.

The newest version!
package com.starksign.error;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

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

public final class InputErrors extends StarkError {

    public List errors;

    public InputErrors(String content) {
        super(content);
        this.errors = new ArrayList<>();

        JsonObject errorsJson = new Gson().fromJson(content, JsonObject.class);
        if (!errorsJson.get("errors").isJsonNull()) {
            for (JsonElement error : errorsJson.get("errors").getAsJsonArray()) {
                JsonObject errorJson = error.getAsJsonObject();
                errors.add(
                        new ErrorElement(
                                errorJson.get("code").getAsString(),
                                errorJson.get("message").getAsString()
                        )
                );
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy