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

com.vk.api.sdk.objects.newsfeed.responses.GetCommentsResponse Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.0.15
Show newest version
package com.vk.api.sdk.objects.newsfeed.responses;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.vk.api.sdk.objects.Validable;
import com.vk.api.sdk.objects.annotations.Required;
import com.vk.api.sdk.objects.groups.GroupFull;
import com.vk.api.sdk.objects.users.UserFull;
import com.vk.api.sdk.oneofs.NewsfeedNewsfeedItemOneOf;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * GetCommentsResponse object
 */
public class GetCommentsResponse implements Validable {
    @SerializedName("items")
    @Required
    private List items;

    @SerializedName("profiles")
    @Required
    private List profiles;

    @SerializedName("groups")
    @Required
    private List groups;

    /**
     * New from value
     */
    @SerializedName("next_from")
    private String nextFrom;

    public List getItems() {
        return items.stream().map(NewsfeedNewsfeedItemOneOf::new).collect(Collectors.toList());
    }

    public List getProfiles() {
        return profiles;
    }

    public GetCommentsResponse setProfiles(List profiles) {
        this.profiles = profiles;
        return this;
    }

    public List getGroups() {
        return groups;
    }

    public GetCommentsResponse setGroups(List groups) {
        this.groups = groups;
        return this;
    }

    public String getNextFrom() {
        return nextFrom;
    }

    public GetCommentsResponse setNextFrom(String nextFrom) {
        this.nextFrom = nextFrom;
        return this;
    }

    @Override
    public int hashCode() {
        return Objects.hash(profiles, groups, nextFrom, items);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        GetCommentsResponse getCommentsResponse = (GetCommentsResponse) o;
        return Objects.equals(nextFrom, getCommentsResponse.nextFrom) &&
                Objects.equals(profiles, getCommentsResponse.profiles) &&
                Objects.equals(groups, getCommentsResponse.groups) &&
                Objects.equals(items, getCommentsResponse.items);
    }

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

    public String toPrettyString() {
        final StringBuilder sb = new StringBuilder("GetCommentsResponse{");
        sb.append("nextFrom='").append(nextFrom).append("'");
        sb.append(", profiles=").append(profiles);
        sb.append(", groups=").append(groups);
        sb.append(", items=").append(items);
        sb.append('}');
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy