C
- The type of callbackR
- The type of network responseE
- The type of error (if any)D
- The type of data to loadpublic class BaseResponseLoaderWrapper<C,R,E,D> extends BaseLoaderWrapper<BaseResponse<R,E,D>>
BaseLoaderWrapper
class to provide CacheLoader
support. Most implementations should not use
BaseResponseLoaderWrapper
directly, but instead utilise RetrofitLoaderWrapper
or RetrofitLoaderWrapper.RetrofitLoaderBuilder
.Modifier and Type | Class and Description |
---|---|
static class |
BaseResponseLoaderWrapper.BaseResponseLoaderBuilder<C,R,E,D>
Builder class for
BaseResponseLoaderWrapper objects. |
static class |
BaseResponseLoaderWrapper.BaseResponseLoaderExtendedBuilder<C,R,E,D,T>
Builder class for
BaseResponseLoaderWrapper objects. |
static class |
BaseResponseLoaderWrapper.BaseResponseLoaderExtendedWrapper<C,R,E,D>
Extends the
BaseResponseLoaderWrapper class. |
static interface |
BaseResponseLoaderWrapper.CoreLoad
The
CoreLoad component is responsible for data loading. |
BaseLoaderWrapper.LoaderBuilder<D>, BaseLoaderWrapper.LoaderFactory<D>, BaseLoaderWrapper.SwipeRefreshWrapper
Constructor and Description |
---|
BaseResponseLoaderWrapper(Context context,
Fragment fragment,
Integer loaderId,
Core.Requester<C> requester,
String tableName,
String description,
BaseResponse.Converter<D> converter,
Core.UriResolver uriResolver)
Initialises a newly created
BaseResponseLoaderWrapper object. |
Modifier and Type | Method and Description |
---|---|
static void |
clearCache(BaseResponseLoaderWrapper.CoreLoad coreLoad)
Clears all cache associated with given
CoreLoad component. |
BaseLoaderWrapper |
findLoader(Collection<BaseLoaderWrapper> loaders)
Please refer to the base method description.
|
BaseCacheAdapter.CacheAdapter<R,E,D> |
getAdapter()
Returns the adapter.
|
BaseRx.LoaderRx<R,E,D> |
getRx()
Returns the Rx component.
|
String |
getTableName()
Returns the table name.
|
Type |
getType()
Returns the type of data to load.
|
Loader<BaseResponse<R,E,D>> |
onCreateLoader(int id,
Bundle args)
Please refer to the base method description.
|
void |
onLoaderReset(Loader<BaseResponse<R,E,D>> loader)
Please refer to the base method description.
|
void |
onLoadFinished(Loader<BaseResponse<R,E,D>> loader,
BaseResponse<R,E,D> data)
Please refer to the base method description.
|
BaseResponseLoaderWrapper<C,R,E,D> |
setAdapter(BaseCacheAdapter.CacheAdapter<R,E,D> adapter)
Sets adapter.
|
BaseResponseLoaderWrapper<C,R,E,D> |
setRx(BaseRx.LoaderRx<R,E,D> rx)
Sets Rx component.
|
geLoaderCallbacks, geLoaderFactory, generateLoaderId, getFragment, getLoaderId, getResult, isLoaderIdAutoGenerated, isLoading, setLoaderCallbacks, setLoaderFactory, setProgress, setSwipeRefreshWrapper, start, start, startSync, startSync, startSync, toString
public BaseResponseLoaderWrapper(@NonNull Context context, @NonNull Fragment fragment, Integer loaderId, @NonNull Core.Requester<C> requester, @NonNull String tableName, String description, @NonNull BaseResponse.Converter<D> converter, @NonNull Core.UriResolver uriResolver)
BaseResponseLoaderWrapper
object.context
- The contextfragment
- The fragmentloaderId
- The loader IDrequester
- The requestertableName
- The name of the table in the database (to cache the loaded data)description
- The data descriptionconverter
- The converteruriResolver
- The URI resolverpublic static void clearCache(BaseResponseLoaderWrapper.CoreLoad coreLoad)
CoreLoad
component.coreLoad
- The CoreLoad
componentpublic Type getType()
public BaseResponseLoaderWrapper<C,R,E,D> setAdapter(BaseCacheAdapter.CacheAdapter<R,E,D> adapter)
adapter
- The adapterBaseResponseLoaderWrapper
objectpublic BaseResponseLoaderWrapper<C,R,E,D> setRx(BaseRx.LoaderRx<R,E,D> rx)
rx
- The Rx componentBaseLoaderWrapper
objectpublic BaseRx.LoaderRx<R,E,D> getRx()
public BaseCacheAdapter.CacheAdapter<R,E,D> getAdapter()
public String getTableName()
public BaseLoaderWrapper findLoader(Collection<BaseLoaderWrapper> loaders)
findLoader
in class BaseLoaderWrapper<BaseResponse<R,E,D>>
loaders
- The loaders collectionBaseLoaderWrapper
object or null (if not found)@CallSuper public Loader<BaseResponse<R,E,D>> onCreateLoader(int id, Bundle args)
onCreateLoader
in interface LoaderManager.LoaderCallbacks<BaseResponse<R,E,D>>
onCreateLoader
in class BaseLoaderWrapper<BaseResponse<R,E,D>>
@CallSuper public void onLoadFinished(Loader<BaseResponse<R,E,D>> loader, BaseResponse<R,E,D> data)
onLoadFinished
in interface LoaderManager.LoaderCallbacks<BaseResponse<R,E,D>>
onLoadFinished
in class BaseLoaderWrapper<BaseResponse<R,E,D>>
@CallSuper public void onLoaderReset(Loader<BaseResponse<R,E,D>> loader)
onLoaderReset
in interface LoaderManager.LoaderCallbacks<BaseResponse<R,E,D>>
onLoaderReset
in class BaseLoaderWrapper<BaseResponse<R,E,D>>
Copyright © 2015-2017 akha, a.k.a. Alexander Kharitonov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.