Android Open Source - acs-android-sdk C C User






From Project

Back to project page acs-android-sdk.

License

The source code is released under:

Apache License

If you think the Android project acs-android-sdk 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.appcelerator.cloud.sdk;
/* www  .j a va2  s  .c o  m*/
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import org.json.JSONObject;

public class CCUser extends CCObject implements Externalizable {
  private String first;
  private String last;
  private String email;
  private String userName;

  private static final int FFIRST = 0x01;
  private static final int FLAST = 0x02;
  private static final int FEMAIL = 0x04;
  private static final int FUSERNAME = 0x08;

  private transient int nullMask = 0;

  public String getFirst() {
    return first;
  }

  public String getLast() {
    return last;
  }

  public String getEmail() {
    return email;
  }

  public String getUserName() {
    return userName;
  }

  public CCUser() {
    super();
  }

  public CCUser(JSONObject jObject) throws ACSClientError {
    super(jObject);

    try {
      first = jObject.getString(CCConstants.FIRST_NAME).trim();
    } catch (Exception e) {
    }

    try {
      last = jObject.getString(CCConstants.LAST_NAME).trim();
    } catch (Exception e) {
    }

    try {
      email = jObject.getString(CCConstants.EMAIL).trim();
    } catch (Exception e) {
    }

    try {
      userName = jObject.getString(CCConstants.USERNAME).trim();
    } catch (Exception e) {
    }
  }

  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    nullMask = in.readInt();

    if ((nullMask & FFIRST) == 0) {
      this.first = in.readUTF();
    }

    if ((nullMask & FLAST) == 0) {
      this.last = in.readUTF();
    }

    if ((nullMask & FEMAIL) == 0) {
      this.email = in.readUTF();
    }

    if ((nullMask & FUSERNAME) == 0) {
      this.userName = in.readUTF();
    }

  }

  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    nullMask |= (first == null) ? FFIRST : 0;
    nullMask |= (last == null) ? FLAST : 0;
    nullMask |= (email == null) ? FEMAIL : 0;
    nullMask |= (userName == null) ? FUSERNAME : 0;
    out.writeInt(nullMask);

    if ((nullMask & FFIRST) == 0) {
      out.writeUTF(first);
    }

    if ((nullMask & FLAST) == 0) {
      out.writeUTF(last);
    }

    if ((nullMask & FEMAIL) == 0) {
      out.writeUTF(email);
    }

    if ((nullMask & FUSERNAME) == 0) {
      out.writeUTF(userName);
    }
  }

}




Java Source Code List

com.appcelerator.cloud.demo.BaloonLayout.java
com.appcelerator.cloud.demo.CheckinAdapter.java
com.appcelerator.cloud.demo.DemoApplication.java
com.appcelerator.cloud.demo.DemoSession.java
com.appcelerator.cloud.demo.Explore.java
com.appcelerator.cloud.demo.MyDlgCustomizer.java
com.appcelerator.cloud.demo.PlaceAdapter.java
com.appcelerator.cloud.demo.PlaceView.java
com.appcelerator.cloud.demo.SignUp.java
com.appcelerator.cloud.demo.TabView.java
com.appcelerator.cloud.demo.UserView.java
com.appcelerator.cloud.pushdemo.ArrivalActivity.java
com.appcelerator.cloud.pushdemo.CustomReceiver.java
com.appcelerator.cloud.pushdemo.ExtendedReceiver.java
com.appcelerator.cloud.pushdemo.GCMUtility.java
com.appcelerator.cloud.pushdemo.PushActivity.java
com.appcelerator.cloud.pushdemo.PushNotificationsManager.java
com.appcelerator.cloud.sdk.ACSClientError.java
com.appcelerator.cloud.sdk.ACSClient.java
com.appcelerator.cloud.sdk.CCConstants.java
com.appcelerator.cloud.sdk.CCMeta.java
com.appcelerator.cloud.sdk.CCMultipartEntity.java
com.appcelerator.cloud.sdk.CCObject.java
com.appcelerator.cloud.sdk.CCPagination.java
com.appcelerator.cloud.sdk.CCRequestMethod.java
com.appcelerator.cloud.sdk.CCResponse.java
com.appcelerator.cloud.sdk.CCUser.java
com.appcelerator.cloud.sdk.SerializableCookie.java
com.appcelerator.cloud.sdk.oauth2.ACSClientDialog.java
com.appcelerator.cloud.sdk.oauth2.DialogError.java
com.appcelerator.cloud.sdk.oauth2.DialogListener.java
com.appcelerator.cloud.sdk.oauth2.DlgCustomizer.java
com.appcelerator.cloud.sdk.oauth2.Util.java
com.appcelerator.com.cloud.demotest.TestDriver.java