<commit_before>//
// This file is part of the Fuel Java SDK.
//
// Copyright (C) 2013, 2014 ExactTarget, Inc.
// All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

package com.exacttarget.fuelsdk;

import java.util.Date;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.annotations.Expose;

import org.apache.log4j.Logger;

import com.exacttarget.fuelsdk.annotations.RestAnnotations;

public abstract class ETRestObjectImmutable extends ETObject {
    private static Logger logger = Logger.getLogger(ETRestObjectImmutable.class);

    @Expose
    private String id = null;
    @Expose
    private String key = null;
    @Expose
    private Date createdDate = null;
    @Expose
    private Date modifiedDate = null;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    protected void toStringOpen() {
        toStringReset();
        toStringAppend(getClass().getName());
        toStringAppend("[");
        toStringAppend("id", getId());
        toStringAppend("key", getKey());
        toStringAppend("createdDate", getCreatedDate());
        toStringAppend("modifiedDate", getModifiedDate());
    }

    protected void toStringClose() {
        toStringAppend("]", false); // don't want a new line here
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                  Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, null, null, null, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                  Integer page,
                                                                  Integer pageSize,
                                                                  Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, null, page, pageSize, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                  String filter,
                                                                  Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, filter, null, null, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                  String filter,
                                                                  Integer page,
                                                                  Integer pageSize,
                                                                  Class<T> type)
        throws ETSdkException
    {
        ETResponse<T> response = new ETResponse<T>();

        ETRestConnection connection = client.getRestConnection();

        Gson gson = connection.getGson();

        JsonParser jsonParser = new JsonParser();

        RestAnnotations annotations = type.getAnnotation(RestAnnotations.class);

        assert annotations != null;<commit_msg>minor formatting updates<commit_after>//
// This file is part of the Fuel Java SDK.
//
// Copyright (C) 2013, 2014 ExactTarget, Inc.
// All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

package com.exacttarget.fuelsdk;

import java.util.Date;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.annotations.Expose;

import org.apache.log4j.Logger;

import com.exacttarget.fuelsdk.annotations.RestAnnotations;

public abstract class ETRestObjectImmutable extends ETObject {
    private static Logger logger = Logger.getLogger(ETRestObjectImmutable.class);

    @Expose
    private String id = null;
    @Expose
    private String key = null;
    @Expose
    private Date createdDate = null;
    @Expose
    private Date modifiedDate = null;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    protected void toStringOpen() {
        toStringReset();
        toStringAppend(getClass().getName());
        toStringAppend("[");
        toStringAppend("id", getId());
        toStringAppend("key", getKey());
        toStringAppend("createdDate", getCreatedDate());
        toStringAppend("modifiedDate", getModifiedDate());
    }

    protected void toStringClose() {
        toStringAppend("]", false); // don't want a new line here
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                           Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, null, null, null, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                           Integer page,
                                                                           Integer pageSize,
                                                                           Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, null, page, pageSize, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                           String filter,
                                                                           Class<T> type)
        throws ETSdkException
    {
        return retrieve(client, filter, null, null, type);
    }

    public static <T extends ETRestObjectImmutable> ETResponse<T> retrieve(ETClient client,
                                                                           String filter,
                                                                           Integer page,
                                                                           Integer pageSize,
                                                                           Class<T> type,
                                                                           String... properties)
        throws ETSdkException
    {
        if (properties != null) {
            // XXX true?
            throw new ETSdkException("REST objects do not support partial retrieves");
        }

        ETResponse<T> response = new ETResponse<T>();

        ETRestConnection connection = client.getRestConnection();

        Gson gson = connection.getGson();

        JsonParser jsonParser = new JsonParser();

        RestAnnotations annotations = type.getAnnotation(RestAnnotations.class);

        assert annotations != null;
{'fraction_non_alphanumeric': 0.0758834718190009, 'fraction_numerical': 0.0018019821803984383, 'mean_word_length': 1.8316326530612246, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 53, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5325075', 'n_tokens_mistral': 2344, 'n_tokens_neox': 2240, 'n_words': 815}