Android Open Source - Pipe Ad Response






From Project

Back to project page Pipe.

License

The source code is released under:

MIT License

If you think the Android project Pipe listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.westudio.android.protocol;
//ww  w .  j  a va 2  s. co m
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class AdResponse extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AdResponse\",\"namespace\":\"com.westudio.java.protocol.v1\",\"fields\":[{\"name\":\"ads\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Person\",\"fields\":[{\"name\":\"id\",\"type\":\"int\",\"default\":0},{\"name\":\"lastName\",\"type\":\"string\"},{\"name\":\"postCode\",\"type\":\"string\"},{\"name\":\"address1\",\"type\":\"string\"},{\"name\":\"address2\",\"type\":\"string\"},{\"name\":\"firstName\",\"type\":\"string\"},{\"name\":\"country\",\"type\":\"string\"},{\"name\":\"city\",\"type\":\"string\"}]}}},{\"name\":\"errors\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":[]}]}");
    public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
    @Deprecated public java.util.List<Person> ads;
    @Deprecated public java.util.List<CharSequence> errors;

    /**
     * Default constructor.  Note that this does not initialize fields
     * to their default values from the schema.  If that is desired then
     * one should use <code>newBuilder()</code>.
     */
    public AdResponse() {}

    /**
     * All-args constructor.
     */
    public AdResponse(java.util.List<Person> ads, java.util.List<CharSequence> errors) {
        this.ads = ads;
        this.errors = errors;
    }

    public org.apache.avro.Schema getSchema() { return SCHEMA$; }
    // Used by DatumWriter.  Applications should not call.
    public Object get(int field$) {
        switch (field$) {
            case 0: return ads;
            case 1: return errors;
            default: throw new org.apache.avro.AvroRuntimeException("Bad index");
        }
    }
    // Used by DatumReader.  Applications should not call.
    @SuppressWarnings(value="unchecked")
    public void put(int field$, Object value$) {
        switch (field$) {
            case 0: ads = (java.util.List<Person>)value$; break;
            case 1: errors = (java.util.List<CharSequence>)value$; break;
            default: throw new org.apache.avro.AvroRuntimeException("Bad index");
        }
    }

    /**
     * Gets the value of the 'ads' field.
     */
    public java.util.List<Person> getAds() {
        return ads;
    }

    /**
     * Sets the value of the 'ads' field.
     * @param value the value to set.
     */
    public void setAds(java.util.List<Person> value) {
        this.ads = value;
    }

    /**
     * Gets the value of the 'errors' field.
     */
    public java.util.List<CharSequence> getErrors() {
        return errors;
    }

    /**
     * Sets the value of the 'errors' field.
     * @param value the value to set.
     */
    public void setErrors(java.util.List<CharSequence> value) {
        this.errors = value;
    }

    /** Creates a new AdResponse RecordBuilder */
    public static AdResponse.Builder newBuilder() {
        return new AdResponse.Builder();
    }

    /** Creates a new AdResponse RecordBuilder by copying an existing Builder */
    public static AdResponse.Builder newBuilder(AdResponse.Builder other) {
        return new AdResponse.Builder(other);
    }

    /** Creates a new AdResponse RecordBuilder by copying an existing AdResponse instance */
    public static AdResponse.Builder newBuilder(AdResponse other) {
        return new AdResponse.Builder(other);
    }

    /**
     * RecordBuilder for AdResponse instances.
     */
    public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AdResponse>
            implements org.apache.avro.data.RecordBuilder<AdResponse> {

        private java.util.List<Person> ads;
        private java.util.List<CharSequence> errors;

        /** Creates a new Builder */
        private Builder() {
            super(AdResponse.SCHEMA$);
        }

        /** Creates a Builder by copying an existing Builder */
        private Builder(AdResponse.Builder other) {
            super(other);
            if (isValidValue(fields()[0], other.ads)) {
                this.ads = data().deepCopy(fields()[0].schema(), other.ads);
                fieldSetFlags()[0] = true;
            }
            if (isValidValue(fields()[1], other.errors)) {
                this.errors = data().deepCopy(fields()[1].schema(), other.errors);
                fieldSetFlags()[1] = true;
            }
        }

        /** Creates a Builder by copying an existing AdResponse instance */
        private Builder(AdResponse other) {
            super(AdResponse.SCHEMA$);
            if (isValidValue(fields()[0], other.ads)) {
                this.ads = data().deepCopy(fields()[0].schema(), other.ads);
                fieldSetFlags()[0] = true;
            }
            if (isValidValue(fields()[1], other.errors)) {
                this.errors = data().deepCopy(fields()[1].schema(), other.errors);
                fieldSetFlags()[1] = true;
            }
        }

        /** Gets the value of the 'ads' field */
        public java.util.List<Person> getAds() {
            return ads;
        }

        /** Sets the value of the 'ads' field */
        public AdResponse.Builder setAds(java.util.List<Person> value) {
            validate(fields()[0], value);
            this.ads = value;
            fieldSetFlags()[0] = true;
            return this;
        }

        /** Checks whether the 'ads' field has been set */
        public boolean hasAds() {
            return fieldSetFlags()[0];
        }

        /** Clears the value of the 'ads' field */
        public AdResponse.Builder clearAds() {
            ads = null;
            fieldSetFlags()[0] = false;
            return this;
        }

        /** Gets the value of the 'errors' field */
        public java.util.List<CharSequence> getErrors() {
            return errors;
        }

        /** Sets the value of the 'errors' field */
        public AdResponse.Builder setErrors(java.util.List<CharSequence> value) {
            validate(fields()[1], value);
            this.errors = value;
            fieldSetFlags()[1] = true;
            return this;
        }

        /** Checks whether the 'errors' field has been set */
        public boolean hasErrors() {
            return fieldSetFlags()[1];
        }

        /** Clears the value of the 'errors' field */
        public AdResponse.Builder clearErrors() {
            errors = null;
            fieldSetFlags()[1] = false;
            return this;
        }

        @Override
        public AdResponse build() {
            try {
                AdResponse record = new AdResponse();
                record.ads = fieldSetFlags()[0] ? this.ads : (java.util.List<Person>) defaultValue(fields()[0]);
                record.errors = fieldSetFlags()[1] ? this.errors : (java.util.List<CharSequence>) defaultValue(fields()[1]);
                return record;
            } catch (Exception e) {
                throw new org.apache.avro.AvroRuntimeException(e);
            }
        }
    }
}




Java Source Code List

com.westudio.android.pipe.ApplicationTest.java
com.westudio.android.pipe.MainActivity.java
com.westudio.android.protocol.AdRequest.java
com.westudio.android.protocol.AdResponse.java
com.westudio.android.protocol.AvroAdRequest.java
com.westudio.android.protocol.AvroAdResponse.java
com.westudio.android.protocol.Person.java
com.westudio.android.sdk.exceptions.NetworkError.java
com.westudio.android.sdk.exceptions.ServiceClientError.java
com.westudio.android.sdk.http.ResponseHandler.java
com.westudio.android.sdk.http.ServiceCallback.java
com.westudio.android.sdk.http.ServiceClient.java
com.westudio.android.sdk.loopj.android.http.AsyncHttpClient.java
com.westudio.android.sdk.loopj.android.http.AsyncHttpRequest.java
com.westudio.android.sdk.loopj.android.http.AsyncHttpResponseHandler.java
com.westudio.android.sdk.loopj.android.http.RequestParams.java
com.westudio.android.sdk.loopj.android.http.ResponseHandlerInterface.java
com.westudio.android.sdk.loopj.android.http.SimpleMultipartEntity.java
com.westudio.android.sdk.utils.ALog.java
com.westudio.android.sdk.utils.Serializer.java