public final class GenericClient<D> extends Object
There are two copies of this file, one in clover-android-sdk and one in schema-tool, please keep them in sync.
Modifier and Type | Class and Description |
---|---|
static interface |
GenericClient.StrictValidationFailedCallback |
Constructor and Description |
---|
GenericClient(D callingObject)
Constructs a new GenericClient with the instance of the declaring class saved.
|
GenericClient(GenericClient src)
Constructs a new instance that is a deep copy of the source instance.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
cacheGet(ExtractableEnum cacheKey)
Replacement for the various cache methods.
|
boolean |
cacheHasKey(ExtractableEnum cacheKey) |
void |
cacheMarkDirty(ExtractableEnum cacheKey) |
void |
cacheRemoveValue(ExtractableEnum cacheKey) |
boolean |
cacheValueIsNotNull(ExtractableEnum cacheKey) |
void |
clear(ExtractableEnum key)
Clears the 'field' field, the 'has' method for this field will now return false
|
boolean |
containsChanges()
Returns true if this instance has any changes.
|
<T extends Enum<T>> |
extractEnum(String name,
Class<T> clazz)
Generic method that replaces the "extract" methods which dealt with an Enum.
|
<T extends Enum<T>> |
extractListEnum(String name,
Class<T> clazz)
Generic method that returns a list of T items.
|
<T> List<T> |
extractListOther(String name,
Class<T> clazz)
Generic method that returns a list of T items.
|
<T> List<T> |
extractListRecord(String name,
JSONifiable.Creator<T> JSON_CREATOR)
Generic method that returns a list of T items.
|
Map |
extractMap(String name)
Generic method that replaces the "extract" methods which dealt with a Map.
|
<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).
|
<T> T |
extractRecord(String name,
JSONifiable.Creator<T> JSON_CREATOR)
Generic method that replaces the "extract" methods which dealt with a Record.
|
Bundle |
getBundle()
Gets a Bundle which can be used to get and set data attached to this instance.
|
Bundle |
getChangeLog()
Get access to changeLog
|
JSONObject |
getJsonObject() |
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.
|
void |
initJsonObject(String json) |
void |
logChange(String field)
Update log when necessary.
|
void |
mergeChanges(JSONObject srcObj,
GenericClient srcGC)
Generic method that replaces the "mergeChanges" method in all the classes.
|
void |
resetChangeLog()
Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
|
<T> D |
setArrayOther(List<T> list,
ExtractableEnum key)
Generic method that replaces the "set" methods which dealt with Arrays that hold non-Records.
|
<T extends JSONifiable> |
setArrayRecord(List<T> list,
ExtractableEnum key)
Generic method that replaces the "set" methods which dealt with Arrays that hold Records.
|
void |
setBundle(Bundle newBundle)
Change bundle to a new bundle sent in.
|
void |
setChangeLog(Bundle newChangeLog)
Change log to a new log sent in.
|
void |
setJsonObject(JSONObject newJSONObject) |
<T> D |
setOther(T item,
ExtractableEnum key)
Generic method that replaces the "set" methods which dealt with anything else (not an Array or Record).
|
<T extends JSONifiable> |
setRecord(T item,
ExtractableEnum key)
Generic method that replaces the "set" methods which dealt with Records.
|
static void |
setStrictValidationFailedCallback(GenericClient.StrictValidationFailedCallback callback)
For internal use only.
|
String |
toString() |
void |
unlogChange(String field)
Remove from log when necessary.
|
void |
validateCloverId(ExtractableEnum cacheKey,
String id)
Check if the given id is a valid Clover ID, if not throw IllegalArgumentException.
|
void |
validateLength(ExtractableEnum cacheKey,
String value,
long maxLength) |
void |
validateLength(String value,
long maxLength)
Deprecated.
Use
validateLength(ExtractableEnum, String, long) instead. |
void |
validateMax(ExtractableEnum cacheKey,
Double value,
double max) |
void |
validateMax(ExtractableEnum cacheKey,
Float value,
double max) |
void |
validateMax(ExtractableEnum cacheKey,
Integer value,
long max) |
void |
validateMax(ExtractableEnum cacheKey,
Long value,
long max) |
void |
validateMin(ExtractableEnum cacheKey,
Double value,
double min) |
void |
validateMin(ExtractableEnum cacheKey,
Float value,
double min) |
void |
validateMin(ExtractableEnum cacheKey,
Integer value,
long min) |
void |
validateMin(ExtractableEnum cacheKey,
Long value,
long min) |
void |
validateMinMax(ExtractableEnum cacheKey,
Double value,
double min,
double max) |
void |
validateMinMax(ExtractableEnum cacheKey,
Float value,
double min,
double max) |
void |
validateMinMax(ExtractableEnum cacheKey,
Integer value,
long min,
long max) |
void |
validateMinMax(ExtractableEnum cacheKey,
Long value,
long min,
long max) |
<T> void |
validateNotNull(ExtractableEnum cacheKey,
T value) |
<T> void |
validateNull(T field,
String name)
Deprecated.
Use
validateNotNull(ExtractableEnum, Object) instead |
void |
validateReferences(ExtractionStrategyEnum cacheKey) |
void |
writeToParcel(Parcel dest,
int flags)
Method that replaces the "writeToParcel" methods.
|
public GenericClient(D callingObject)
public GenericClient(GenericClient src)
public <T> T cacheGet(ExtractableEnum cacheKey)
public boolean cacheValueIsNotNull(ExtractableEnum cacheKey)
public boolean cacheHasKey(ExtractableEnum cacheKey)
public void cacheRemoveValue(ExtractableEnum cacheKey)
public void cacheMarkDirty(ExtractableEnum cacheKey)
@Deprecated public <T> void validateNull(T field, String name)
validateNotNull(ExtractableEnum, Object)
insteadpublic <T> void validateNotNull(ExtractableEnum cacheKey, T value)
@Deprecated public void validateLength(String value, long maxLength)
validateLength(ExtractableEnum, String, long)
instead.public void validateLength(ExtractableEnum cacheKey, String value, long maxLength)
public void validateMin(ExtractableEnum cacheKey, Integer value, long min)
public void validateMax(ExtractableEnum cacheKey, Integer value, long max)
public void validateMinMax(ExtractableEnum cacheKey, Integer value, long min, long max)
public void validateMin(ExtractableEnum cacheKey, Long value, long min)
public void validateMax(ExtractableEnum cacheKey, Long value, long max)
public void validateMinMax(ExtractableEnum cacheKey, Long value, long min, long max)
public void validateMin(ExtractableEnum cacheKey, Float value, double min)
public void validateMax(ExtractableEnum cacheKey, Float value, double max)
public void validateMinMax(ExtractableEnum cacheKey, Float value, double min, double max)
public void validateMin(ExtractableEnum cacheKey, Double value, double min)
public void validateMax(ExtractableEnum cacheKey, Double value, double max)
public void validateMinMax(ExtractableEnum cacheKey, Double value, double min, double max)
public void validateCloverId(ExtractableEnum cacheKey, String id)
public void validateReferences(ExtractionStrategyEnum cacheKey)
public static void setStrictValidationFailedCallback(GenericClient.StrictValidationFailedCallback callback)
public JSONObject getJsonObject()
public void setJsonObject(JSONObject newJSONObject)
public void initJsonObject(String json)
public JSONObject getJSONObject()
public void logChange(String field)
public void unlogChange(String field)
public boolean containsChanges()
public void resetChangeLog()
public void setChangeLog(Bundle newChangeLog)
public void clear(ExtractableEnum key)
public Bundle getBundle()
public void setBundle(Bundle newBundle)
public Bundle getChangeLog()
public <T> List<T> extractListRecord(String name, JSONifiable.Creator<T> JSON_CREATOR)
public <T extends Enum<T>> List<T> extractListEnum(String name, Class<T> clazz)
public <T> List<T> extractListOther(String name, Class<T> clazz)
public <T> T extractRecord(String name, JSONifiable.Creator<T> JSON_CREATOR)
public <T extends Enum<T>> T extractEnum(String name, Class<T> clazz)
public Map extractMap(String name)
public <T> T extractOther(String name, Class<T> clazz)
public <T extends JSONifiable> D setArrayRecord(List<T> list, ExtractableEnum key)
public <T> D setArrayOther(List<T> list, ExtractableEnum key)
public <T extends JSONifiable> D setRecord(T item, ExtractableEnum key)
public <T> D setOther(T item, ExtractableEnum key)
public void mergeChanges(JSONObject srcObj, GenericClient srcGC)
public void writeToParcel(Parcel dest, int flags)