本文整理匯總了Java中org.dmfs.jems.single.Single類的典型用法代碼示例。如果您正苦於以下問題:Java Single類的具體用法?Java Single怎麽用?Java Single使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Single類屬於org.dmfs.jems.single包,在下文中一共展示了Single類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TextRequestEntity
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public TextRequestEntity(final MediaType mediaType, final Single<CharSequence> charSequence)
{
super(new BinaryRequestEntity(mediaType, new Single<byte[]>()
{
@Override
public byte[] value()
{
try
{
return charSequence.value().toString().getBytes(mediaType.charset("utf-8"));
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException(String.format(Locale.ENGLISH, "Encoding %s not supported by runtime", mediaType.charset("utf-8")), e);
}
}
}));
}
示例2: iterator
import org.dmfs.jems.single.Single; //導入依賴的package包/類
@Override
public Iterator<Single<ContentValues>> iterator()
{
Optional<DateTime> start = new NullSafe<>(mTaskAdapter.valueOf(TaskAdapter.DTSTART));
// effective due is either the actual due, start + duration or absent
Optional<DateTime> effectiveDue = new FirstPresent<>(
new Seq<>(
new NullSafe<>(mTaskAdapter.valueOf(TaskAdapter.DUE)),
new Zipped<>(start, new NullSafe<>(mTaskAdapter.valueOf(TaskAdapter.DURATION)), DateTime::addDuration)));
Single<ContentValues> baseData = new Distant(mTaskAdapter.valueOf(TaskAdapter.IS_CLOSED) ? -1 : 0,
new Enduring(new DueDated(effectiveDue, new StartDated(start, new VanillaInstanceData()))));
// TODO: implement support for recurrence, for now we only return the first instance
return new SingletonIterator<>(mTaskAdapter.isRecurring() ?
new Overridden(new NullSafe<>(mTaskAdapter.valueOf(TaskAdapter.ORIGINAL_INSTANCE_TIME)), baseData)
:
baseData);
}
示例3: XWwwFormUrlEncodedEntity
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public XWwwFormUrlEncodedEntity(final ParameterList values)
{
super(new TextRequestEntity(new StructuredMediaType("application", "x-www-form-urlencoded"),
new Single<CharSequence>()
{
@Override
public CharSequence value()
{
return new XWwwFormUrlEncoded(values);
}
}));
}
示例4: JsonRequestEntity
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public JsonRequestEntity(final JSONArray jsonArray)
{
this(new Single<CharSequence>()
{
@Override
public CharSequence value()
{
return jsonArray.toString();
}
});
}
示例5: Dated
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public Dated(Optional<DateTime> dateTime, String timeStampColumn, String sortingColumn, Single<ContentValues> delegate)
{
super(new Zipped<>(
dateTime,
delegate,
(dateTime1, values) ->
{
// add timestamp and sorting
values.put(timeStampColumn, dateTime1.getTimestamp());
values.put(sortingColumn, dateTime1.isAllDay() ? dateTime1.getInstance() : dateTime1.shiftTimeZone(TimeZone.getDefault()).getInstance());
return values;
}));
}
示例6: Distant
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public Distant(int distance, Single<ContentValues> delegate)
{
super(() ->
{
ContentValues values = delegate.value();
values.put(TaskContract.Instances.DISTANCE_FROM_CURRENT, distance);
return values;
});
}
示例7: create
import org.dmfs.jems.single.Single; //導入依賴的package包/類
/**
* Creates an intent for sharing the description of the whole task in the {@link ContentSet} with other apps.
*
* @param contentSet
* actual {@link ContentSet} for the task
* @param model
* the model used currently
*
* @return the created intent
*/
@Override
public Intent create(ContentSet contentSet, Model model, Context context)
{
Single<CharSequence> title = new TaskShareTitle(contentSet);
Single<CharSequence> body = new TaskShareDetails(contentSet, model, context);
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, title.value().toString());
sendIntent.putExtra(Intent.EXTRA_TEXT, body.value().toString());
sendIntent.setType("text/plain");
return sendIntent;
}
示例8: OkHttpExecutor
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public OkHttpExecutor(Single<OkHttpClient> okHttpClient)
{
this(new PlainOkHttpExecutor(okHttpClient));
}
示例9: PlainOkHttpExecutor
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public PlainOkHttpExecutor(Single<OkHttpClient> okHttpClient)
{
mOkHttpClient = okHttpClient;
}
示例10: ApacheExecutor
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public ApacheExecutor(Single<HttpClient> apacheClient)
{
this(new PlainApacheExecutor(apacheClient));
}
示例11: PlainApacheExecutor
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public PlainApacheExecutor(Single<HttpClient> client)
{
mClient = client;
}
示例12: BinaryRequestEntity
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public BinaryRequestEntity(MediaType mediaType, Single<byte[]> data)
{
mMediaType = mediaType;
mData = data;
}
示例13: testContentType
import org.dmfs.jems.single.Single; //導入依賴的package包/類
@Test
public void testContentType()
{
MediaType dummy = dummy(MediaType.class);
assertThat(new TextRequestEntity(dummy, dummy(Single.class)).contentType(), isPresent(sameInstance(dummy)));
}
示例14: testContentType
import org.dmfs.jems.single.Single; //導入依賴的package包/類
@Test
public void testContentType() throws Exception
{
assertThat(new BinaryRequestEntity(new StructuredMediaType("application", "text"), dummy(Single.class)).contentType(),
PresentMatcher.<MediaType>isPresent(new StringMediaType("application/text")));
}
示例15: DueDated
import org.dmfs.jems.single.Single; //導入依賴的package包/類
public DueDated(Optional<DateTime> due, Single<ContentValues> delegate)
{
super(new Dated(due, TaskContract.Instances.INSTANCE_DUE, TaskContract.Instances.INSTANCE_DUE_SORTING, delegate));
}