Android Open Source - transloadit-Android-sdk Parsed Api Data






From Project

Back to project page transloadit-Android-sdk.

License

The source code is released under:

MIT License

If you think the Android project transloadit-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 hu.szabot.transloadit.executor;
/* w w  w .j a  v  a  2 s. com*/
import hu.szabot.transloadit.ApiData;
import hu.szabot.transloadit.exceptions.NotParseableException;
import hu.szabot.transloadit.log.TransloaditLogger;
import hu.szabot.transloadit.parser.IRequestParser;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**Stores information which can be sent via an HTTP request. This object contains the parsed data.*/
public class ParsedApiData {
  
  
  /**The parsed fields (custom and params)*/
  private Map<String,String> fields;
  
  /**File objects of the files which will be sent*/
  private Map<String,File> files;
  
  /**Creates a new empty ParsedApiData object.*/
  public ParsedApiData() 
  {
    fields = new HashMap<String, String>();
    files =  new HashMap<String, File>();
  }

  /** 
   * Creates a new ParsedApiData object with the given parser.
   * @param data The raw api data.
   * @param parser The parser to create from the data object
   */
  public ParsedApiData(ApiData data,IRequestParser parser) 
  {
    this();
    
    if(data!=null)
    {
      files.putAll(data.getFiles());
      fields.putAll(data.getFields());
      
      parser.setRequest(data.getParams());
      
      try 
      {
        
        fields.put("params", parser.parse());
      
      } catch (NotParseableException e) 
      {
        TransloaditLogger.logError(getClass(), e);
      }
    }
  }
  
  /**Gets the data fields of a request (key - value pairs)*/
  public Map<String, String> getFields() {
    return fields;
  }
  
  /**Gets the File objects of the files which will be sent*/
  public Map<String, File> getFiles() {
    return files;
  }
  
}




Java Source Code List

hu.szabot.transloadit.ApiData.java
hu.szabot.transloadit.IApiRequest.java
hu.szabot.transloadit.IApiResponse.java
hu.szabot.transloadit.ITransloadit.java
hu.szabot.transloadit.TransloaditRequest.java
hu.szabot.transloadit.TransloaditResponse.java
hu.szabot.transloadit.Transloadit.java
hu.szabot.transloadit.assembly.AssemblyBuilder.java
hu.szabot.transloadit.assembly.IAssemblyBuilder.java
hu.szabot.transloadit.assembly.IStep.java
hu.szabot.transloadit.assembly.Step.java
hu.szabot.transloadit.assembly.exceptions.AlreadyDefinedKeyException.java
hu.szabot.transloadit.assembly.exceptions.InvalidFieldKeyException.java
hu.szabot.transloadit.exceptions.FileNotOpenableException.java
hu.szabot.transloadit.exceptions.NotParseableException.java
hu.szabot.transloadit.executor.DefaultHttpExecutor.java
hu.szabot.transloadit.executor.IRequestExecutor.java
hu.szabot.transloadit.executor.ParsedApiData.java
hu.szabot.transloadit.log.TransloaditLogger.java
hu.szabot.transloadit.parser.IRequestParser.java
hu.szabot.transloadit.parser.IResponseParser.java
hu.szabot.transloadit.parser.JSONRequestParser.java
hu.szabot.transloadit.parser.JSONResponseParser.java
hu.szabot.transloadit.utils.ShaUtils.java