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

org.sourcelab.github.client.objects.PullRequest Maven / Gradle / Ivy

The newest version!
package org.sourcelab.github.client.objects;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class PullRequest {
    private final String url;
    private final long number;
    private final Head head;
    private final Base base;

    /**
     * Constructor.
     */
    @JsonCreator
    public PullRequest(
        @JsonProperty("url") final String url,
        @JsonProperty("number") final long number,
        @JsonProperty("head") final Head head,
        @JsonProperty("base") final Base base
    ) {
        this.url = url;
        this.number = number;
        this.head = head;
        this.base = base;
    }

    public String getUrl() {
        return url;
    }

    public long getNumber() {
        return number;
    }

    public Head getHead() {
        return head;
    }

    public Base getBase() {
        return base;
    }

    @Override
    public String toString() {
        return "PullRequest{"
            + "\n\turl='" + url + '\''
            + "\n\tnumber=" + number
            + "\n\thead=" + head
            + "\n\tbase=" + base
            + "\n}";
    }

    public static class Base extends Head {
        /**
         * Constructor.
         */
        @JsonCreator
        public Base(
            @JsonProperty("ref") final String ref,
            @JsonProperty("sha") final String sha,
            @JsonProperty("repo") final Repo repo) {
            super(ref, sha, repo);
        }
    }

    public static class Head {
        private final String ref;
        private final String sha;
        private final Repo repo;

        /**
         * Constructor.
         */
        @JsonCreator
        public Head(
            @JsonProperty("ref") final String ref,
            @JsonProperty("sha") final String sha,
            @JsonProperty("repo") final Repo repo) {
            this.ref = ref;
            this.sha = sha;
            this.repo = repo;
        }

        public String getRef() {
            return ref;
        }

        public String getSha() {
            return sha;
        }

        public Repo getRepo() {
            return repo;
        }
    }

    public static class Repo {
        private final String url;
        private final String name;

        /**
         * Constructor.
         */
        @JsonCreator
        public Repo(
            @JsonProperty("url") final String url,
            @JsonProperty("name") final String name
        ) {
            this.url = url;
            this.name = name;
        }

        public String getUrl() {
            return url;
        }

        public String getName() {
            return name;
        }

        @Override
        public String toString() {
            return "Repo{"
                + "\n\turl='" + url + '\''
                + "\n\tname='" + name + '\''
                + "\n}";
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy