程序包 cn.leancloud

类 LCObject

    • 字段详细资料

      • KEY_CREATED_AT

        public static final java.lang.String KEY_CREATED_AT
        另请参阅:
        常量字段值
      • KEY_UPDATED_AT

        public static final java.lang.String KEY_UPDATED_AT
        另请参阅:
        常量字段值
      • KEY_OBJECT_ID

        public static final java.lang.String KEY_OBJECT_ID
        另请参阅:
        常量字段值
      • KEY_ACL

        public static final java.lang.String KEY_ACL
        另请参阅:
        常量字段值
      • KEY_CLASSNAME

        public static final java.lang.String KEY_CLASSNAME
        另请参阅:
        常量字段值
      • KEY_IGNORE_HOOKS

        public static final java.lang.String KEY_IGNORE_HOOKS
        另请参阅:
        常量字段值
      • logger

        protected static final LCLogger logger
      • UUID_LEN

        protected static final int UUID_LEN
      • className

        protected java.lang.String className
      • endpointClassName

        protected transient java.lang.String endpointClassName
      • objectId

        protected transient java.lang.String objectId
      • serverData

        protected java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Object> serverData
      • operations

        protected transient java.util.concurrent.ConcurrentMap<java.lang.String,​cn.leancloud.ops.ObjectFieldOperation> operations
      • acl

        protected transient LCACL acl
      • totallyOverwrite

        protected volatile boolean totallyOverwrite
    • 构造器详细资料

      • LCObject

        public LCObject()
        Default constructor.
      • LCObject

        public LCObject​(java.lang.String className)
        Constructor with class name.
        参数:
        className - class name.
      • LCObject

        public LCObject​(LCObject other)
        Copy constructor.
        参数:
        other - other instance.
    • 方法详细资料

      • getClassName

        public java.lang.String getClassName()
        Get class name.
        返回:
        class name.
      • internalClassName

        public java.lang.String internalClassName()
        Get internal class name.
        返回:
        internal class name.
      • setClassName

        public void setClassName​(java.lang.String name)
        Set class name.
        参数:
        name - class name.
      • getCreatedAt

        public java.util.Date getCreatedAt()
        Get createdAt date.
        返回:
        createdAt date.
      • getCreatedAtString

        public java.lang.String getCreatedAtString()
        Get createdAt string.
        返回:
        createdAt string.
      • getUpdatedAt

        public java.util.Date getUpdatedAt()
        Get updatedAt date.
        返回:
        updatedAt date.
      • getUpdatedAtString

        public java.lang.String getUpdatedAtString()
        Get updatedAt string.
        返回:
        updatedAt string.
      • getObjectId

        public java.lang.String getObjectId()
        Get objectId.
        返回:
        objectId.
      • setObjectId

        public void setObjectId​(java.lang.String objectId)
        Set objectId.
        参数:
        objectId - object id.
      • isFetchWhenSave

        public boolean isFetchWhenSave()
        Flag to fetchWhenSave.
        返回:
        flag for fetchWhenSave.
      • setFetchWhenSave

        public void setFetchWhenSave​(boolean fetchWhenSave)
        Set fetchWhenSave flag.
        参数:
        fetchWhenSave - flag.
      • getUuid

        public java.lang.String getUuid()
        Get UUID.
        返回:
        UUID. Caution: public this method just for compatibility.
      • verifyInternalId

        protected static boolean verifyInternalId​(java.lang.String internalId)
      • internalId

        protected java.lang.String internalId()
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Contain specified key.
        参数:
        key - key
        返回:
        flag to indicate current object contains the specified key or not.
      • has

        public boolean has​(java.lang.String key)
        Contain specified key.
        参数:
        key - key
        返回:
        flag to indicate current object contains the specified key or not.
      • get

        public java.lang.Object get​(java.lang.String key)
        Get value of specified key.
        参数:
        key - specified key.
        返回:
        the value associated with specified key.
      • internalGet

        protected java.lang.Object internalGet​(java.lang.String key)
      • getBoolean

        public boolean getBoolean​(java.lang.String key)
        Get boolean value of specified key.
        参数:
        key - specified key.
        返回:
        the boolean value associated with specified key.
      • getBytes

        public byte[] getBytes​(java.lang.String key)
        Get bytes value of specified key.
        参数:
        key - specified key.
        返回:
        the bytes value associated with specified key.
      • getDate

        public java.util.Date getDate​(java.lang.String key)
        Get Date value of specified key.
        参数:
        key - specified key.
        返回:
        the Date value associated with specified key.
      • getString

        public java.lang.String getString​(java.lang.String key)
        Get string value of specified key.
        参数:
        key - specified key.
        返回:
        the string value associated with specified key.
      • getInt

        public int getInt​(java.lang.String key)
        Get int value of specified key.
        参数:
        key - specified key.
        返回:
        the int value associated with specified key.
      • getLong

        public long getLong​(java.lang.String key)
        Get long value of specified key.
        参数:
        key - specified key.
        返回:
        the long value associated with specified key.
      • getDouble

        public double getDouble​(java.lang.String key)
        Get double value of specified key.
        参数:
        key - specified key.
        返回:
        the double value associated with specified key.
      • getNumber

        public java.lang.Number getNumber​(java.lang.String key)
        Get numeric value of specified key.
        参数:
        key - specified key.
        返回:
        the numeric value associated with specified key.
      • getList

        public java.util.List getList​(java.lang.String key)
        Get list value of specified key.
        参数:
        key - specified key.
        返回:
        the list value associated with specified key.
      • getJSONArray

        public JSONArray getJSONArray​(java.lang.String key)
        Get jsonarray value of specified key.
        参数:
        key - specified key.
        返回:
        the jsonarray value associated with specified key.
      • getJSONObject

        public JSONObject getJSONObject​(java.lang.String key)
        Get jsonobject value of specified key.
        参数:
        key - specified key.
        返回:
        the jsonobject value associated with specified key.
      • getLCGeoPoint

        public LCGeoPoint getLCGeoPoint​(java.lang.String key)
        Get AVGeoPoint value of specified key.
        参数:
        key - specified key.
        返回:
        the AVGeoPoint value associated with specified key.
      • getLCFile

        public LCFile getLCFile​(java.lang.String key)
        Get AVFile value of specified key.
        参数:
        key - specified key.
        返回:
        the AVFile value associated with specified key.
      • getLCObject

        public <T extends LCObject> T getLCObject​(java.lang.String key)
        Get AVObject value of specified key.
        类型参数:
        T - template type
        参数:
        key - specified key.
        返回:
        the AVObject value associated with specified key.
      • getRelation

        public <T extends LCObjectLCRelation<T> getRelation​(java.lang.String key)
        Get AVRelation value of specified key.
        类型参数:
        T - template type
        参数:
        key - specified key.
        返回:
        the AVRelation value associated with specified key.
      • getServerData

        public java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Object> getServerData()
        Get server data.
        返回:
        map of server data.
      • validFieldName

        protected void validFieldName​(java.lang.String key)
      • isDataAvailable

        public boolean isDataAvailable()
        Flag to indicate data is available or not.
        返回:
        available flag.
      • add

        public void add​(java.lang.String key,
                        java.lang.Object value)
        Add attribute.
        参数:
        key - target key.
        value - value object.
      • addAll

        public void addAll​(java.lang.String key,
                           java.util.Collection<?> values)
        Add collection attribute.
        参数:
        key - target key.
        values - values collection.
      • addUnique

        public void addUnique​(java.lang.String key,
                              java.lang.Object value)
        Add unique attribute.
        参数:
        key - target key.
        value - value object.
      • addAllUnique

        public void addAllUnique​(java.lang.String key,
                                 java.util.Collection<?> values)
        Add unique collection attribute.
        参数:
        key - target key.
        values - value collection.
      • put

        public void put​(java.lang.String key,
                        java.lang.Object value)
        Set attribute.
        参数:
        key - target key.
        value - value object.
      • internalPut

        protected void internalPut​(java.lang.String key,
                                   java.lang.Object value)
      • remove

        public void remove​(java.lang.String key)
        Remove attribute.
        参数:
        key - target key.
      • removeAll

        public void removeAll​(java.lang.String key,
                              java.util.Collection<?> values)
        Remove all collection.
        参数:
        key - target keys.
        values - value collection.
      • increment

        public void increment​(java.lang.String key)
        Increment one attribute.
        参数:
        key - target key.
      • increment

        public void increment​(java.lang.String key,
                              java.lang.Number value)
        Increment one attribute.
        参数:
        key - target key.
        value - value object.
      • decrement

        public void decrement​(java.lang.String key)
        Decrement one attribute.
        参数:
        key - target key.
      • decrement

        public void decrement​(java.lang.String key,
                              java.lang.Number value)
        Decrement one attribute.
        参数:
        key - target key.
        value - value object.
      • bitAnd

        public void bitAnd​(java.lang.String key,
                           long value)
        Modify integer attribute.
        参数:
        key - target key.
        value - value object.
      • bitOr

        public void bitOr​(java.lang.String key,
                          long value)
        Modify integer attribute.
        参数:
        key - target key.
        value - value object.
      • bitXor

        public void bitXor​(java.lang.String key,
                           long value)
        Modify integer attribute.
        参数:
        key - target key.
        value - value object.
      • abortOperations

        public void abortOperations()
        abort all modify operations. Notice: this method doesn't work for AVInstallation.
      • removeOperationForKey

        protected void removeOperationForKey​(java.lang.String key)
      • addNewOperation

        protected void addNewOperation​(cn.leancloud.ops.ObjectFieldOperation op)
      • generateChangedParam

        protected JSONObject generateChangedParam()
        save/update with server.
        返回:
        json object.
      • extractCascadingObjects

        protected java.util.List<LCObject> extractCascadingObjects​(java.lang.Object o)
      • generateCascadingSaveObjects

        protected io.reactivex.Observable<java.util.List<LCObject>> generateCascadingSaveObjects()
      • extractUnsavedFiles

        protected java.util.List<LCFile> extractUnsavedFiles​(java.lang.Object o)
      • getUnsavedFiles

        protected java.util.List<LCFile> getUnsavedFiles()
      • onSaveSuccess

        protected void onSaveSuccess()
      • onSaveFailure

        protected void onSaveFailure()
      • onDataSynchronized

        protected void onDataSynchronized()
      • saveInBackground

        public io.reactivex.Observable<? extends LCObject> saveInBackground()
        Save object in background.
        返回:
        observable instance.
      • saveInBackground

        public io.reactivex.Observable<? extends LCObject> saveInBackground​(LCUser asAuthenticatedUser)
        Save object in background.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • saveInBackground

        public io.reactivex.Observable<? extends LCObject> saveInBackground​(LCSaveOption option)
        Save object in background.
        参数:
        option - save option.
        返回:
        observable instance.
      • saveInBackground

        public io.reactivex.Observable<? extends LCObject> saveInBackground​(LCUser asAuthenticatedUser,
                                                                            LCSaveOption option)
        Save object in background.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        option - save option.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • hasCircleReference

        public boolean hasCircleReference​(java.util.Map<LCObject,​java.lang.Boolean> markMap)
        judge operations' value include circle reference or not. notice: internal used, pls not invoke it.
        参数:
        markMap - markup map.
        返回:
        flag to indicate there is circle reference or not.
      • save

        public void save()
        Save in blocking mode.
      • save

        public void save​(LCUser asAuthenticatedUser)
        Save in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication. in general, this method should be invoked in lean engine.
      • saveAll

        public static void saveAll​(java.util.Collection<? extends LCObject> objects)
                            throws LCException
        Save All objects in blocking mode.
        参数:
        objects - object collection.
        抛出:
        LCException - error happened.
      • saveAll

        public static void saveAll​(LCUser asAuthenticatedUser,
                                   java.util.Collection<? extends LCObject> objects)
                            throws LCException
        Save All objects in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        objects - object collection.
        抛出:
        LCException - error happened. in general, this method should be invoked in lean engine.
      • saveAllInBackground

        public static io.reactivex.Observable<JSONArray> saveAllInBackground​(java.util.Collection<? extends LCObject> objects)
        Save all objects in async mode.
        参数:
        objects - object collection.
        返回:
        observable instance.
      • saveAllInBackground

        public static io.reactivex.Observable<JSONArray> saveAllInBackground​(LCUser asAuthenticatedUser,
                                                                             java.util.Collection<? extends LCObject> objects)
        Save all objects in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        objects - object collection.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • saveEventually

        public void saveEventually()
                            throws LCException
        Save eventually.
        抛出:
        LCException - error happened.
      • saveEventually

        public void saveEventually​(LCUser asAuthenticatedUser)
                            throws LCException
        Save eventually.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        抛出:
        LCException - error happened. in general, this method should be invoked in lean engine.
      • deleteEventually

        public void deleteEventually()
        Delete current object eventually.
      • deleteEventually

        public void deleteEventually​(LCUser asAuthenticatedUser)
        Delete current object eventually.
        参数:
        asAuthenticatedUser - explicit user for request authentication. in general, this method should be invoked in lean engine.
      • deleteInBackground

        public io.reactivex.Observable<LCNull> deleteInBackground()
        Delete current object in async mode.
        返回:
        observable instance.
      • deleteInBackground

        public io.reactivex.Observable<LCNull> deleteInBackground​(LCUser asAuthenticatedUser)
        Delete current object in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • delete

        public void delete()
        Delete current object in blocking mode.
      • delete

        public void delete​(LCUser asAuthenticatedUser)
        Delete current object in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication. in general, this method should be invoked in lean engine.
      • deleteAll

        public static void deleteAll​(java.util.Collection<? extends LCObject> objects)
                              throws LCException
        Delete all objects in blocking mode.
        参数:
        objects - object collection.
        抛出:
        LCException - error happened.
      • deleteAll

        public static void deleteAll​(LCUser asAuthenticatedUser,
                                     java.util.Collection<? extends LCObject> objects)
                              throws LCException
        Delete all objects in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        objects - object collection.
        抛出:
        LCException - error happened. in general, this method should be invoked in lean engine.
      • deleteAllInBackground

        public static io.reactivex.Observable<LCNull> deleteAllInBackground​(java.util.Collection<? extends LCObject> objects)
        Delete all objects in async mode.
        参数:
        objects - object collection.
        返回:
        observable instance.
      • deleteAllInBackground

        public static io.reactivex.Observable<LCNull> deleteAllInBackground​(LCUser asAuthenticatedUser,
                                                                            java.util.Collection<? extends LCObject> objects)
        Delete all objects in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        objects - object collection.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • refresh

        public void refresh()
        Refresh current object in blocking mode.
      • refresh

        public void refresh​(java.lang.String includeKeys)
        Refresh current object in blocking mode.
        参数:
        includeKeys - include keys, which object will be return together.
      • refresh

        public void refresh​(LCUser asAuthenticatedUser,
                            java.lang.String includeKeys)
        Refresh current object in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        includeKeys - include keys, which object will be return together. in general, this method should be invoked in lean engine.
      • refreshInBackground

        public io.reactivex.Observable<LCObject> refreshInBackground()
        Refresh current object in async mode.
        返回:
        observable instance.
      • refreshInBackground

        public io.reactivex.Observable<LCObject> refreshInBackground​(LCUser asAuthenticatedUser)
        Refresh current object in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • refreshInBackground

        public io.reactivex.Observable<LCObject> refreshInBackground​(java.lang.String includeKeys)
        Refresh current object in async mode.
        参数:
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance.
      • refreshInBackground

        public io.reactivex.Observable<LCObject> refreshInBackground​(LCUser asAuthenticatedUser,
                                                                     java.lang.String includeKeys)
        Refresh current object in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • fetch

        public LCObject fetch()
        Fetch current object in blocking mode.
        返回:
        current object.
      • fetch

        public LCObject fetch​(java.lang.String includeKeys)
        Fetch current object in blocking mode.
        参数:
        includeKeys - include keys, which object will be return together.
        返回:
        current object.
      • fetch

        public LCObject fetch​(LCUser asAuthenticatedUser,
                              java.lang.String includeKeys)
        Fetch current object in blocking mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        includeKeys - include keys, which object will be return together.
        返回:
        current object. in general, this method should be invoked in lean engine.
      • fetchInBackground

        public io.reactivex.Observable<LCObject> fetchInBackground()
        Fetch current object in async mode.
        返回:
        observable instance.
      • fetchInBackground

        public io.reactivex.Observable<LCObject> fetchInBackground​(java.lang.String includeKeys)
        Fetch current object in async mode.
        参数:
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance.
      • fetchInBackground

        public io.reactivex.Observable<LCObject> fetchInBackground​(LCUser asAuthenticatedUser,
                                                                   java.lang.String includeKeys)
        Fetch current object in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • fetchIfNeededInBackground

        public io.reactivex.Observable<LCObject> fetchIfNeededInBackground()
        Fetch current object if needed in async mode.
        返回:
        observable instance.
      • fetchIfNeededInBackground

        public io.reactivex.Observable<LCObject> fetchIfNeededInBackground​(java.lang.String includeKeys)
        Fetch current object if needed in async mode.
        参数:
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance.
      • fetchIfNeededInBackground

        public io.reactivex.Observable<LCObject> fetchIfNeededInBackground​(LCUser asAuthenticatedUser,
                                                                           java.lang.String includeKeys)
        Fetch current object if needed in async mode.
        参数:
        asAuthenticatedUser - explicit user for request authentication.
        includeKeys - include keys, which object will be return together.
        返回:
        observable instance. in general, this method should be invoked in lean engine.
      • fetchIfNeeded

        public LCObject fetchIfNeeded()
        Fetch current object in blocking mode.
        返回:
        current object.
      • resetAll

        protected void resetAll()
      • resetByRawData

        protected void resetByRawData​(LCObject LCObject)
      • resetServerData

        public void resetServerData​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Reset server data with new data.
        参数:
        data - new data.
      • getRequestRawEndpoint

        public java.lang.String getRequestRawEndpoint()
        Get request endpoint.
        返回:
        endpoint.
      • getRequestMethod

        public java.lang.String getRequestMethod()
        Get request method.
        返回:
        http method.
      • registerSubclass

        public static <T extends LCObject> void registerSubclass​(java.lang.Class<T> clazz)
        Register subclass to AVOSCloud SDK.It must be invocated before AVOSCloud.initialize.
        类型参数:
        T - template type.
        参数:
        clazz - The subclass.
        从以下版本开始:
        1.3.6
      • getACL

        public LCACL getACL()
        get ACL
        返回:
        acl object.
      • setACL

        public void setACL​(LCACL acl)
        Set ACL
        参数:
        acl - acl object.
      • generateACLFromServerData

        protected LCACL generateACLFromServerData()
      • getQuery

        public static <T extends LCObjectLCQuery<T> getQuery​(java.lang.Class<T> clazz)
        Get query for class.
        类型参数:
        T - result type.
        参数:
        clazz - target class.
        返回:
        query instance.
      • toJSONObject

        public JSONObject toJSONObject()
        Generate a new json object with server data.
        返回:
        json object.
      • toJSONString

        public java.lang.String toJSONString()
        Generate a json string.
        返回:
        json string.
      • parseLCObject

        public static LCObject parseLCObject​(java.lang.String objectString)
        Create AVObject instance from json string which generated by AVObject.toString or AVObject.toJSONString.
        参数:
        objectString - json string.
        返回:
        AVObject instance, null if objectString is null
      • createWithoutData

        public static LCObject createWithoutData​(java.lang.String className,
                                                 java.lang.String objectId)
        Create a new instance with particular classname and objectId.
        参数:
        className - class name
        objectId - object id
        返回:
        AVObject instance
      • createWithoutData

        public static <T extends LCObject> T createWithoutData​(java.lang.Class<T> clazz,
                                                               java.lang.String objectId)
                                                        throws LCException
        Create a new instance with particular class and objectId.
        类型参数:
        T - template type.
        参数:
        clazz - class info
        objectId - object id
        返回:
        AVObject instance
        抛出:
        LCException - error happened.
      • disableBeforeHook

        public void disableBeforeHook()
        disable beforeXXX Hooks
      • disableAfterHook

        public void disableAfterHook()
        disable afterXXX Hooks
      • ignoreHook

        public void ignoreHook​(LCObject.Hook hook)
        ignore specified Hook
        参数:
        hook - target Hook.
      • cast

        protected static <T extends LCObject> T cast​(LCObject object,
                                                     java.lang.Class<T> clazz)
                                              throws java.lang.Exception
        抛出:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        覆盖:
        equals 在类中 java.lang.Object
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 java.lang.Object