Android Open Source - RestIt Object Mapping






From Project

Back to project page RestIt.

License

The source code is released under:

Apache License

If you think the Android project RestIt 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 org.restit.objectmapping;
/* ww w.  j a  va 2 s. c om*/
import java.util.HashMap;
import java.util.Map;

/**
 * Used to create a mapping object that can be easily defined without writing specific serializer and deserializer
 *  objects
 * @author coneill
 *
 */
public class ObjectMapping {

  private Class clazz;
  private String jsonName;
  private Map<String, String> attributeMap;
  
  /**
   * Constructor
   * @param jsonName The JSON class key name
   * @param clazz The POJO class
   */
  public ObjectMapping(String jsonName, Class clazz)
  {
    this.jsonName = jsonName;
    this.clazz = clazz;
  }
  
  /**
   * Get the attribute map
   * @return
   */
  private Map<String, String> getAttributeMap()
  {
    if(this.attributeMap == null)
    {
      this.attributeMap = new HashMap<String, String>();
    }
    
    return this.attributeMap;
  }
  
  /**
   * Add a direct mapping between the response key name and the POJO attribute
   * @param responseKey
   * @param pojoVariable
   */
  public void addAttributeMapping(String responseKey, String pojoAttribute)
  {
    if(responseKey == null || pojoAttribute == null)
      return;
    
    getAttributeMap().put(responseKey, pojoAttribute);
  }
  
}




Java Source Code List

org.restit.model.ServerError.java
org.restit.model.serialization.ServerErrorDeserializer.java
org.restit.model.serialization.ServerErrorSerializer.java
org.restit.network.AsyncCallback.java
org.restit.network.ContentType.java
org.restit.network.IRestItNetworkListener.java
org.restit.network.NetworkNotAvailableException.java
org.restit.network.NetworkUtil.java
org.restit.network.ProgressListener.java
org.restit.network.RequestMethod.java
org.restit.network.RequestOptions.java
org.restit.network.RestItClient.java
org.restit.network.RestItNetworkStatus.java
org.restit.network.RestIt.java
org.restit.network.ServerAsyncTask.java
org.restit.network.ServerErrorException.java
org.restit.network.insecure.NullHostNameVerifier.java
org.restit.network.insecure.NullX509TrustManager.java
org.restit.objectmapping.ClassRegistration.java
org.restit.objectmapping.ObjectMapping.java
org.restit.objectmapping.RestItMapper.java