public class Parse
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Parse.DefaultParseObjectFactory
A factory for instantiating reserved Parse Object classes such as users,
roles, installations and sessions.
|
static class |
Parse.EPlatform |
static interface |
Parse.IParseObjectFactory
A factory for instantiating ParseObjects of various concrete types
|
static interface |
Parse.IPersistable
An interface for a persistable entity.
|
Constructor and Description |
---|
Parse() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
encodeDate(java.util.Date date)
Encodes the provided date in the format required by Parse.
|
static java.lang.String |
getApiEndpoint()
Retrieves the Parse API endpoint without a trailing '/'.
|
static java.lang.String |
getApplicationId() |
static java.lang.String |
getClientKey() |
static java.lang.String |
getParseAPIUrl(java.lang.String endPoint)
Creates a valid Parse REST API URL using the predefined
apiEndpoint provided in initialize(java.lang.String, java.lang.String, java.lang.String) . |
static Parse.EPlatform |
getPlatform()
Retrieves the current platform
|
static int |
getSerializationVersion()
Retrieves the default ID to be used for serialization of objects.
|
static void |
initialize(java.lang.String apiEndpoint,
java.lang.String applicationId,
java.lang.String clientKey)
Authenticates this client as belonging to your application.
|
static boolean |
isEmpty(java.lang.String str) |
static boolean |
isInitialized()
Checks if the library has been initialized.
|
static boolean |
isReservedEndPoint(java.lang.String endPoint)
Checks if the provided
endPoint is the name of an in-built Parse
end point, for examples (users and /classes/_User). |
static boolean |
isReservedKey(java.lang.String key)
Checks if the provided
key is a key with a special meaning in
Parse, for example objectId . |
static boolean |
isValidType(java.lang.Object value)
Checks if the provided type is a valid type for a Parse Object or any one
of its fields.
|
static java.lang.String |
join(java.util.Collection<java.lang.String> items,
java.lang.String delimiter)
Utility to concatenate the strings in
items using the provided
delimieter . |
static java.util.Date |
parseDate(java.lang.String dateString)
Converts a Parse date string value into a Date object.
|
public static Parse.EPlatform getPlatform()
Parse.EPlatform.UNKNOWN
public static void initialize(java.lang.String apiEndpoint, java.lang.String applicationId, java.lang.String clientKey)
It also initializes internal state required for the library to function properly, e.g., enabling persistence to CN1 storage.
This method must be called before your application can use the Parse library. The recommended way is to put a call to Parse.initialize in your CN1 Application's state machine as follows:
public class StateMachine extends StateMachineBase {
protected void initVars(Resources res) {
Parse.initialize(API_ENDPOINT, APP_ID, APP_REST_API_ID);
}
}
apiEndpoint
- The path to the Parse backend, e.g.
"your_parse_backend_website_url"/parse.applicationId
- The application id of your parse backend.clientKey
- The client key of your parse backend if applicable. If not,
pass null and it will be ignored.
Note: Developers are advised to use the CLIENT KEY instead of using the REST API in production code (cf. https://parse.com/docs/rest#general-callfromclient). Hence, the latter is not exposed via this library. The same security consideration explains why the MASTER KEY is not exposed either.
public static java.lang.String getApiEndpoint()
initialize(java.lang.String, java.lang.String, java.lang.String)
public static java.lang.String getApplicationId()
initialize(java.lang.String, java.lang.String, java.lang.String)
public static java.lang.String getClientKey()
initialize(java.lang.String, java.lang.String, java.lang.String)
public static boolean isInitialized()
Note: The optional client key (cf. getClientKey()
)
is no longer taken into account.
true
if the library has been initialized; otherwise,
returns false
.initialize(java.lang.String, java.lang.String, java.lang.String)
public static java.lang.String getParseAPIUrl(java.lang.String endPoint)
apiEndpoint
provided in initialize(java.lang.String, java.lang.String, java.lang.String)
.endPoint
- The target endpoint/class name.public static java.lang.String encodeDate(java.util.Date date)
date
- The date to be encoded.date
expressed in the format required by Parse.public static java.util.Date parseDate(java.lang.String dateString)
dateString
- A string matching the Parse date type.dateString
.public static boolean isReservedKey(java.lang.String key)
key
is a key with a special meaning in
Parse, for example objectId
.key
- The key to be checked.true
if and only if key
is a reserved key.public static boolean isReservedEndPoint(java.lang.String endPoint)
endPoint
is the name of an in-built Parse
end point, for examples (users and /classes/_User).endPoint
- The endpoint to be checked.true
if endPoint
is a reserved class end point.public static boolean isValidType(java.lang.Object value)
value
- The object to be checkedtrue
if value
is valid as per the data types
supported by ParseObjects and their child fields.public static java.lang.String join(java.util.Collection<java.lang.String> items, java.lang.String delimiter)
items
using the provided
delimieter
.items
- The strings to be concatenated.delimiter
- The delimiter.public static boolean isEmpty(java.lang.String str)
public static int getSerializationVersion()
Externalizable.getVersion()