Class GenericClient<D>


  • public final class GenericClient<D>
    extends Object
    For Clover internal use only.

    There are two copies of this file, one in clover-android-sdk and one in schema-tool, please keep them in sync.

    • Constructor Detail

      • GenericClient

        public GenericClient​(D callingObject)
        Constructs a new GenericClient with the instance of the declaring class saved.
      • GenericClient

        public GenericClient​(GenericClient src)
        Constructs a new instance that is a deep copy of the source instance. It does not copy the bundle or changelog.
    • Method Detail

      • cacheGet

        public <T> T cacheGet​(ExtractableEnum cacheKey)
        Replacement for the various cache methods.
      • cacheValueIsNotNull

        public boolean cacheValueIsNotNull​(ExtractableEnum cacheKey)
      • cacheRemoveValue

        public void cacheRemoveValue​(ExtractableEnum cacheKey)
      • cacheMarkDirty

        public void cacheMarkDirty​(ExtractableEnum cacheKey)
      • validateNull

        @Deprecated
        public <T> void validateNull​(T field,
                                     String name)
        Deprecated but kept since we do not always regenerate all objects. This method is a misnomer, it should have been validateNotNull since it validates that the field is not null and fails if it is.
      • validateNotNull

        public <T> void validateNotNull​(ExtractableEnum cacheKey,
                                        T value)
      • validateLength

        public void validateLength​(ExtractableEnum cacheKey,
                                   String value,
                                   long maxLength)
      • validateMinMax

        public void validateMinMax​(ExtractableEnum cacheKey,
                                   Integer value,
                                   long min,
                                   long max)
      • validateMinMax

        public void validateMinMax​(ExtractableEnum cacheKey,
                                   Long value,
                                   long min,
                                   long max)
      • validateMinMax

        public void validateMinMax​(ExtractableEnum cacheKey,
                                   Float value,
                                   double min,
                                   double max)
      • validateMinMax

        public void validateMinMax​(ExtractableEnum cacheKey,
                                   Double value,
                                   double min,
                                   double max)
      • validateCloverId

        public void validateCloverId​(ExtractableEnum cacheKey,
                                     String id)
        Check if the given id is a valid Clover ID, if not throw IllegalArgumentException.
      • getJsonObject

        public JSONObject getJsonObject()
      • setJsonObject

        public void setJsonObject​(JSONObject newJSONObject)
      • initJsonObject

        public void initJsonObject​(String json)
      • getJSONObject

        public JSONObject getJSONObject()
        Returns the internal JSONObject backing this instance, the return value is not a copy so changes to it will be reflected in this instance and vice-versa.
      • logChange

        public void logChange​(String field)
        Update log when necessary.
      • unlogChange

        public void unlogChange​(String field)
        Remove from log when necessary.
      • containsChanges

        public boolean containsChanges()
        Returns true if this instance has any changes.
      • resetChangeLog

        public void resetChangeLog()
        Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
      • setChangeLog

        public void setChangeLog​(Bundle newChangeLog)
        Change log to a new log sent in.
      • clear

        public void clear​(ExtractableEnum key)
        Clears the 'field' field, the 'has' method for this field will now return false
      • getBundle

        public Bundle getBundle()
        Gets a Bundle which can be used to get and set data attached to this instance. The attached Bundle will be parcelled but not jsonified.
      • setBundle

        public void setBundle​(Bundle newBundle)
        Change bundle to a new bundle sent in.
      • getChangeLog

        public Bundle getChangeLog()
        Get access to changeLog
      • extractListRecord

        public <T> List<T> extractListRecord​(String name,
                                             JSONifiable.Creator<T> JSON_CREATOR)
        Generic method that returns a list of T items. Replacement for the "extract" methods which dealt with a list of Records.
      • extractListEnum

        public <T extends Enum<T>> List<T> extractListEnum​(String name,
                                                           Class<T> clazz)
        Generic method that returns a list of T items. Replacement for the "extract" methods which dealt with a list of Enums.
      • extractListOther

        public <T> List<T> extractListOther​(String name,
                                            Class<T> clazz)
        Generic method that returns a list of T items. Replacement for the "extract" methods which dealt with a list of other items (neither Records nor Enums).
      • extractRecord

        public <T> T extractRecord​(String name,
                                   JSONifiable.Creator<T> JSON_CREATOR)
        Generic method that replaces the "extract" methods which dealt with a Record.
      • extractEnum

        public <T extends Enum<T>> T extractEnum​(String name,
                                                 Class<T> clazz)
        Generic method that replaces the "extract" methods which dealt with an Enum.
      • extractMap

        public Map extractMap​(String name)
        Generic method that replaces the "extract" methods which dealt with a Map.
      • extractOther

        public <T> T extractOther​(String name,
                                  Class<T> clazz)
        Generic method that replaces the "extract" methods which dealt with anything else (not a Record, Enum, or Map).
      • setArrayRecord

        public <T extends JSONifiableD setArrayRecord​(List<T> list,
                                                        ExtractableEnum key)
        Generic method that replaces the "set" methods which dealt with Arrays that hold Records.
      • setArrayOther

        public <T> D setArrayOther​(List<T> list,
                                   ExtractableEnum key)
        Generic method that replaces the "set" methods which dealt with Arrays that hold non-Records.
      • setRecord

        public <T extends JSONifiableD setRecord​(T item,
                                                   ExtractableEnum key)
        Generic method that replaces the "set" methods which dealt with Records.
      • setOther

        public <T> D setOther​(T item,
                              ExtractableEnum key)
        Generic method that replaces the "set" methods which dealt with anything else (not an Array or Record).
      • mergeChanges

        public void mergeChanges​(JSONObject srcObj,
                                 GenericClient srcGC)
        Generic method that replaces the "mergeChanges" method in all the classes.
      • writeToParcel

        public void writeToParcel​(Parcel dest,
                                  int flags)
        Method that replaces the "writeToParcel" methods. "flags" seems to be unused, but was also passed in the original classes.