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

com.vk.api.sdk.objects.polls.Answer Maven / Gradle / Ivy

Go to download

Java library for VK API interaction, includes OAuth 2.0 authorization and API methods.

The newest version!
// Autogenerated from vk-api-schema. Please don't edit it manually.
package com.vk.api.sdk.objects.polls;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.vk.api.sdk.objects.Validable;
import com.vk.api.sdk.objects.annotations.Required;
import java.util.Objects;

/**
 * Answer object
 */
public class Answer implements Validable {
    /**
     * Answer ID
     */
    @SerializedName("id")
    @Required
    private Long id;

    /**
     * Answer rate in percents
     */
    @SerializedName("rate")
    @Required
    private Number rate;

    /**
     * Answer text
     */
    @SerializedName("text")
    @Required
    private String text;

    /**
     * Votes number
     */
    @SerializedName("votes")
    @Required
    private Integer votes;

    public Long getId() {
        return id;
    }

    public Answer setId(Long id) {
        this.id = id;
        return this;
    }

    public Number getRate() {
        return rate;
    }

    public Answer setRate(Number rate) {
        this.rate = rate;
        return this;
    }

    public String getText() {
        return text;
    }

    public Answer setText(String text) {
        this.text = text;
        return this;
    }

    public Integer getVotes() {
        return votes;
    }

    public Answer setVotes(Integer votes) {
        this.votes = votes;
        return this;
    }

    @Override
    public int hashCode() {
        return Objects.hash(rate, votes, id, text);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Answer answer = (Answer) o;
        return Objects.equals(rate, answer.rate) &&
                Objects.equals(votes, answer.votes) &&
                Objects.equals(id, answer.id) &&
                Objects.equals(text, answer.text);
    }

    @Override
    public String toString() {
        final Gson gson = new Gson();
        return gson.toJson(this);
    }

    public String toPrettyString() {
        final StringBuilder sb = new StringBuilder("Answer{");
        sb.append("rate=").append(rate);
        sb.append(", votes=").append(votes);
        sb.append(", id=").append(id);
        sb.append(", text='").append(text).append("'");
        sb.append('}');
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy