本文整理汇总了Java中com.facebook.common.internal.Supplier.get方法的典型用法代码示例。如果您正苦于以下问题:Java Supplier.get方法的具体用法?Java Supplier.get怎么用?Java Supplier.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.common.internal.Supplier
的用法示例。
在下文中一共展示了Supplier.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetBitmapCacheGetSupplier
import com.facebook.common.internal.Supplier; //导入方法依赖的package包/类
@Test
public void testGetBitmapCacheGetSupplier() {
Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier =
mImagePipeline.getDataSourceSupplier(
mImageRequest,
mCallerContext,
ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
.thenReturn(bitmapCacheSequence);
dataSourceSupplier.get();
verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
ArgumentCaptor.forClass(ProducerContext.class);
verify(bitmapCacheSequence)
.produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
示例2: testGetFullFetchSupplier
import com.facebook.common.internal.Supplier; //导入方法依赖的package包/类
@Test
public void testGetFullFetchSupplier() {
Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier = mImagePipeline
.getDataSourceSupplier(mImageRequest, mCallerContext, ImageRequest.RequestLevel.FULL_FETCH);
Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
.thenReturn(decodedSequence);
DataSource<CloseableReference<CloseableImage>> dataSource = dataSourceSupplier.get();
assertFalse(dataSource.isFinished());
verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
ArgumentCaptor.forClass(ProducerContext.class);
verify(decodedSequence)
.produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
示例3: setSupplier
import com.facebook.common.internal.Supplier; //导入方法依赖的package包/类
public void setSupplier(@Nullable Supplier<DataSource<T>> supplier) {
// early return without calling {@code supplier.get()} in case we are closed
if (isClosed()) {
return;
}
DataSource<T> oldDataSource;
DataSource<T> newDataSource = (supplier != null) ? supplier.get() : null;
synchronized (RetainingDataSource.this) {
if (isClosed()) {
oldDataSource = newDataSource;
newDataSource = null;
} else {
oldDataSource = mDataSource;
mDataSource = newDataSource;
}
}
if (newDataSource != null) {
newDataSource.subscribe(new InternalDataSubscriber(), CallerThreadExecutor.getInstance());
}
closeSafely(oldDataSource);
}
示例4: setSupplier
import com.facebook.common.internal.Supplier; //导入方法依赖的package包/类
public void setSupplier(@Nullable Supplier<DataSource<T>> supplier) {
// early return without calling {@code supplier.get()} in case we are closed
if (isClosed()) {
return;
}
DataSource<T> oldDataSource;
DataSource<T> newDataSource = (supplier != null) ? supplier.get() : null;
synchronized (RetainingDataSource.this) {
if (isClosed()) {
closeSafely(newDataSource);
return;
} else {
oldDataSource = mDataSource;
mDataSource = newDataSource;
}
}
if (newDataSource != null) {
newDataSource.subscribe(new InternalDataSubscriber(), CallerThreadExecutor.getInstance());
}
closeSafely(oldDataSource);
}
示例5: startNextDataSource
import com.facebook.common.internal.Supplier; //导入方法依赖的package包/类
private boolean startNextDataSource() {
Supplier<DataSource<T>> dataSourceSupplier = getNextSupplier();
DataSource<T> dataSource = (dataSourceSupplier != null) ? dataSourceSupplier.get() : null;
if (setCurrentDataSource(dataSource) && dataSource != null) {
dataSource.subscribe(new InternalDataSubscriber(), CallerThreadExecutor.getInstance());
return true;
} else {
closeSafely(dataSource);
return false;
}
}