Package com.parse

Class ParseCloud


  • public final class ParseCloud
    extends java.lang.Object
    The ParseCloud class defines provides methods for interacting with Parse Cloud Functions. A Cloud Function can be called with callFunctionInBackground(String, Map, FunctionCallback) using a FunctionCallback. For example, this sample code calls the "validateGame" Cloud Function and calls processResponse if the call succeeded and handleError if it failed.

     ParseCloud.callFunctionInBackground("validateGame", parameters, new FunctionCallback() {
          public void done(Object object, ParseException e) {
            if (e == null) {
              processResponse(object);
            } else {
              handleError();
            }
          }
     }
     
    
     

    Using the callback methods is usually preferred because the network operation will not block the calling thread. However, in some cases it may be easier to use the callFunction(String, Map) call which do block the calling thread. For example, if your application has already spawned a background task to perform work, that background task could use the blocking calls and avoid the code complexity of callbacks.

      • Method Summary

        All Methods Static Methods Concrete Methods 
        Modifier and Type Method Description
        static <T> T callFunction​(java.lang.String name, java.util.Map<java.lang.String,​?> params)
        Calls a cloud function.
        static <T> <any> callFunctionInBackground​(java.lang.String name, java.util.Map<java.lang.String,​?> params)
        Calls a cloud function in the background.
        static <T> void callFunctionInBackground​(java.lang.String name, java.util.Map<java.lang.String,​?> params, FunctionCallback<T> callback)
        Calls a cloud function in the background.
        • Methods inherited from class java.lang.Object

          equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Method Detail

        • callFunctionInBackground

          public static <T> <any> callFunctionInBackground​(java.lang.String name,
                                                           java.util.Map<java.lang.String,​?> params)
          Calls a cloud function in the background.
          Parameters:
          name - The cloud function to call.
          params - The parameters to send to the cloud function. This map can contain anything that could be placed in a ParseObject except for ParseObjects themselves.
          Returns:
          A Task that will be resolved when the cloud function has returned.
        • callFunction

          public static <T> T callFunction​(java.lang.String name,
                                           java.util.Map<java.lang.String,​?> params)
                                    throws ParseException
          Calls a cloud function.
          Parameters:
          name - The cloud function to call.
          params - The parameters to send to the cloud function. This map can contain anything that could be placed in a ParseObject except for ParseObjects themselves.
          Returns:
          The result of the cloud call. Result may be a @{link Map}< String, ?>, ParseObject, List<?>, or any type that can be set as a field in a ParseObject.
          Throws:
          ParseException - exception
        • callFunctionInBackground

          public static <T> void callFunctionInBackground​(java.lang.String name,
                                                          java.util.Map<java.lang.String,​?> params,
                                                          FunctionCallback<T> callback)
          Calls a cloud function in the background.
          Parameters:
          name - The cloud function to call.
          params - The parameters to send to the cloud function. This map can contain anything that could be placed in a ParseObject except for ParseObjects themselves.
          callback - The callback that will be called when the cloud function has returned.