Package com.firebase.ui.common
Class BaseCachingSnapshotParser<S,T>
- java.lang.Object
-
- com.firebase.ui.common.BaseCachingSnapshotParser<S,T>
-
- All Implemented Interfaces:
BaseSnapshotParser<S,T>
public abstract class BaseCachingSnapshotParser<S,T> extends Object implements BaseSnapshotParser<S,T>
Implementation ofBaseSnapshotParserthat caches results, so parsing a snapshot repeatedly is not expensive.
-
-
Constructor Summary
Constructors Constructor Description BaseCachingSnapshotParser(BaseSnapshotParser<S,T> parser)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all data in the cache.abstract StringgetId(S snapshot)Get a unique identifier for a snapshot, should not depend on snapshot content.voidinvalidate(S snapshot)Invalidate the cache for a certain document.TparseSnapshot(S snapshot)This method parses the Snapshot into the requested type.
-
-
-
Constructor Detail
-
BaseCachingSnapshotParser
public BaseCachingSnapshotParser(@NonNull BaseSnapshotParser<S,T> parser)
-
-
Method Detail
-
getId
@NonNull public abstract String getId(@NonNull S snapshot)
Get a unique identifier for a snapshot, should not depend on snapshot content.
-
parseSnapshot
@NonNull public T parseSnapshot(@NonNull S snapshot)
Description copied from interface:BaseSnapshotParserThis method parses the Snapshot into the requested type.- Specified by:
parseSnapshotin interfaceBaseSnapshotParser<S,T>- Parameters:
snapshot- the Snapshot to extract the model from- Returns:
- the model extracted from the DataSnapshot
-
clear
public void clear()
Clear all data in the cache.
-
invalidate
public void invalidate(@NonNull S snapshot)Invalidate the cache for a certain document.
-
-