當前位置: 首頁>>代碼示例>>Java>>正文


Java Single類代碼示例

本文整理匯總了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);
            }
        }
    }));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:19,代碼來源:TextRequestEntity.java

示例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);
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:20,代碼來源:InstanceValuesIterable.java

示例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);
                }
            }));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:13,代碼來源:XWwwFormUrlEncodedEntity.java

示例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();
        }
    });
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:12,代碼來源:JsonRequestEntity.java

示例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;
            }));
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:14,代碼來源:Dated.java

示例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;
    });
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:10,代碼來源:Distant.java

示例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;
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:25,代碼來源:ShareIntentFactory.java

示例8: OkHttpExecutor

import org.dmfs.jems.single.Single; //導入依賴的package包/類
public OkHttpExecutor(Single<OkHttpClient> okHttpClient)
{
    this(new PlainOkHttpExecutor(okHttpClient));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:5,代碼來源:OkHttpExecutor.java

示例9: PlainOkHttpExecutor

import org.dmfs.jems.single.Single; //導入依賴的package包/類
public PlainOkHttpExecutor(Single<OkHttpClient> okHttpClient)
{
    mOkHttpClient = okHttpClient;
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:5,代碼來源:PlainOkHttpExecutor.java

示例10: ApacheExecutor

import org.dmfs.jems.single.Single; //導入依賴的package包/類
public ApacheExecutor(Single<HttpClient> apacheClient)
{
    this(new PlainApacheExecutor(apacheClient));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:5,代碼來源:ApacheExecutor.java

示例11: PlainApacheExecutor

import org.dmfs.jems.single.Single; //導入依賴的package包/類
public PlainApacheExecutor(Single<HttpClient> client)
{
    mClient = client;
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:5,代碼來源:PlainApacheExecutor.java

示例12: BinaryRequestEntity

import org.dmfs.jems.single.Single; //導入依賴的package包/類
public BinaryRequestEntity(MediaType mediaType, Single<byte[]> data)
{
    mMediaType = mediaType;
    mData = data;
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:6,代碼來源:BinaryRequestEntity.java

示例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)));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:7,代碼來源:TextRequestEntityTest.java

示例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")));
}
 
開發者ID:dmfs,項目名稱:http-client-essentials-suite,代碼行數:7,代碼來源:BinaryRequestEntityTest.java

示例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));
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:5,代碼來源:DueDated.java


注:本文中的org.dmfs.jems.single.Single類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。