Android Open Source - spotastop Line






From Project

Back to project page spotastop.

License

The source code is released under:

MIT License

If you think the Android project spotastop 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.cipciop.spotastop.domain;
//from www.  j a  v  a  2s .  c om
import java.lang.reflect.Type;
import java.util.ArrayList;

import com.cipciop.spotastop.StopSpotApp;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;

import resources.Resource;
import rest.RestApi;

public class Line extends Resource implements Comparable<Object> {

  private String name;

  private String direzione;

  public Line() {
    super("cipciop\\spotastop\\Line");
  }

  public Line(String name) {
    this.setName(name);
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getName() {
    return this.name;
  }

  public String getDirezione() {
    return direzione;
  }

  public void setDirezione(String direzione) {
    this.direzione = direzione;
  }

  @Override
  public int compareTo(Object another) {

    return this.name.compareTo(((Line) another).name);
  }

  public void store() {
    super.store();
    RestApi.linkResources(this, StopSpotApp.getInstance().getLoggedUser(),
        "creator");
  }

  @Override
  public Resource deserialize(JsonElement arg0, Type arg1,
      JsonDeserializationContext arg2) throws JsonParseException {
    Line turnback = new Line();
    turnback.resourceClassifier = arg0.getAsJsonObject()
        .get("resourceClassifier").getAsString();
    turnback.resourceIdentifier = arg0.getAsJsonObject().get("id")
        .getAsLong();
    if (arg0.getAsJsonObject().get("resourceIdentifier") != null)
      turnback.resourceClassifier = arg0.getAsJsonObject()
          .get("resourceIdentifier").getAsString();
    if (arg0.getAsJsonObject().get("nome") != null)
      turnback.name = arg0.getAsJsonObject().get("nome").getAsString();
    if (arg0.getAsJsonObject().get("direzione") != null)
      turnback.direzione = arg0.getAsJsonObject().get("direzione")
          .getAsString();

    return turnback;
  }


}




Java Source Code List

.LoaderTester.java
com.cipciop.spotastop.ErrorActivity.java
com.cipciop.spotastop.LoginActivity.java
com.cipciop.spotastop.RegisterActivity.java
com.cipciop.spotastop.SelectBusLine.java
com.cipciop.spotastop.SpotActivity.java
com.cipciop.spotastop.StopSpotApp.java
com.cipciop.spotastop.domain.BusStop.java
com.cipciop.spotastop.domain.GeoPos.java
com.cipciop.spotastop.domain.Line.java
com.cipciop.spotastop.domain.User.java
com.cipciop.spotastop.presentation.BusLineItem.java
com.cipciop.spotastop.services.JarvisDynDnsService.java
com.cipciop.spotastop.services.LoginService.java
com.cipciop.spotastop.services.RegistrationService.java
com.cipciop.spotastop.services.RetrieveLinesListService.java
com.cipciop.spotastop.services.SpotBusStopService.java
com.nicfix.gsoncompatibility.GsonConfigurator.java
requests.CreatorRequest.java
requests.Criteria.java
requests.Data.java
requests.EditorRequest.java
requests.Link.java
requests.LinkerRequest.java
requests.LoaderRequest.java
requests.StorerRequest.java
requests.Unlink.java
requests.beContentRequest.java
resources.Resource.java
resources.ResourcesCache.java
resources.ResourcesMapper.java
responses.AsyncCallback.java
responses.beContentResponse.java
rest.RestApi.java
settings.Settings.java