@ SafeVarargs public final void load ( @ NonNull final KeyType key , @ NonNull final ViewType view , final boolean async , @ NonNull final ParamType ... params ) { Condition . INSTANCE . ensureNotNull ( key , "The key may not be null" ) ; Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; Condition . INSTANCE . ensureNotNull ( params , "The array may not be null" ) ; setCanceled ( false ) ; views . put ( view , key ) ; DataType data = getCachedData ( key ) ; if ( ! isCanceled ( ) ) { if ( data != null ) { onPostExecute ( view , data , 0 , params ) ; notifyOnFinished ( key , data , view , params ) ; logger . logInfo ( getClass ( ) , "Loaded data with key " + key + " from cache" ) ; } else { onPreExecute ( view , params ) ; Task < DataType , KeyType , ViewType , ParamType > task = new Task <> ( view , key , params ) ; if ( async ) { loadDataAsynchronously ( task ) ; } else { data = loadData ( task ) ; onPostExecute ( view , data , 0 , params ) ; notifyOnFinished ( key , data , view , params ) ; } } } }
Loads the the data which corresponds to a specific key and displays it in a specific view . If the data has already been loaded it will be retrieved from the cache .