当前位置: 首页>>代码示例>>Java>>正文


Java CDAEntry.getField方法代码示例

本文整理汇总了Java中com.contentful.java.cda.CDAEntry.getField方法的典型用法代码示例。如果您正苦于以下问题:Java CDAEntry.getField方法的具体用法?Java CDAEntry.getField怎么用?Java CDAEntry.getField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.contentful.java.cda.CDAEntry的用法示例。


在下文中一共展示了CDAEntry.getField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processArray

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
private void processArray(CDAEntry entry, AutoEscapeValues values, FieldMeta field) {
  if (field.isArrayOfSymbols()) {
    List<?> list = entry.getField(field.id());
    if (list == null) {
      list = Collections.emptyList();
    }
    saveBlob(entry, values, field, (Serializable) list);
  } else {
    List<?> links = extractRawFieldValue(entry, field.id());
    if (links != null) {
      for (int i = 0; i < links.size(); i++) {
        processLink(entry, field.id(), (Map<?, ?>) links.get(i), i);
      }
    }
  }
}
 
开发者ID:contentful,项目名称:vault,代码行数:17,代码来源:SyncRunnable.java

示例2: insertHelpItem

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
private void insertHelpItem(CDAEntry helpItemEntry) {
  HelpItemViewHolder vh =
      new HelpItemViewHolder(View.inflate(this, R.layout.view_help_item, null));

  // Text
  vh.tvText.setText((String) helpItemEntry.getField("text"));

  // Image
  CDAAsset asset = helpItemEntry.getField("image");

  Picasso.with(this).load("http:" + asset.url())
      .fit()
      .centerInside()
      .into(vh.ivPhoto);

  container.addView(vh.rootView);
}
 
开发者ID:contentful,项目名称:discovery-app-android,代码行数:18,代码来源:HelpActivity.java

示例3: sync

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
@Test
public void sync() throws Exception {
  SynchronizedSpace space = client.sync().observe().blockingFirst();
  assertInitial(space);

  space = client.sync(space).observe().blockingFirst();

  assertThat(space.nextSyncUrl()).isNotEmpty();
  assertThat(space.items()).hasSize(14);
  assertThat(space.deletedEntries()).hasSize(0);

  CDAEntry nyanCat = space.entries().get("nyancat");
  assertThat(nyanCat).isNotNull();
  assertThat(nyanCat.getField("name")).isEqualTo("Nyan vIghro'");
  assertThat(nyanCat.getField("color")).isEqualTo("rainbow");
  List<String> likes = nyanCat.getField("likes");
  assertThat(likes).containsExactly("rainbows", "fish");
}
 
开发者ID:contentful,项目名称:contentful.java,代码行数:19,代码来源:Integration.java

示例4: assertNyanCat

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
private void assertNyanCat(CDAEntry entry) {
  assertThat(entry.id()).isEqualTo("nyancat");
  assertThat(entry.getField("name")).isEqualTo("Nyan Cat");
  assertThat(entry.getField("color")).isEqualTo("rainbow");
  assertThat(entry.getField("birthday")).isEqualTo("2011-04-04T22:00:00+00:00");
  assertThat(entry.getField("lives")).isEqualTo(1337.0);

  List<String> likes = entry.getField("likes");
  assertThat(likes).containsExactly("rainbows", "fish");

  Object bestFriend = entry.getField("bestFriend");
  assertThat(bestFriend).isInstanceOf(CDAEntry.class);
  assertThat(entry).isSameAs(((CDAEntry) bestFriend).getField("bestFriend"));

  // Localization
  assertThat(entry.locale()).isEqualTo("en-US");
  entry.setLocale("tlh");
  assertThat(entry.getField("color")).isEqualTo("rainbow");
  assertThat(entry.getField("non-existing-does-not-throw")).isNull();
}
 
开发者ID:contentful,项目名称:contentful.java,代码行数:21,代码来源:Integration.java

示例5: getTitleForEntry

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
public static String getTitleForEntry(CDAEntry entry, CDAContentType contentType) {
  String displayField = contentType.displayField();

  if (!StringUtils.isBlank(displayField)) {
    String result = entry.getField(displayField);

    if (StringUtils.isNotBlank(result)) {
      return result;
    }
  }

  return CFApp.getInstance().getString(R.string.content_type_default_title);
}
 
开发者ID:contentful,项目名称:discovery-app-android,代码行数:14,代码来源:Utils.java

示例6: performLoad

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
@Override protected Tutorial performLoad() {
  try {
    Tutorial tmp = new Tutorial();
    CDAEntry entry = CFDiscoveryClient.getClient().fetch(CDAEntry.class)
        .one(CFApp.getInstance().getResources().getString(R.string.discovery_space_tutorial_id));

    CDAAsset bgAsset = entry.getField("backgroundImageIPad");

    // Background image
    tmp.backgroundImageUrl = "http:" + bgAsset.url();

    // Pages
    tmp.pages = new ArrayList<>();
    ArrayList<?> pages = entry.getField("pages");
    for (Object p : pages) {
      if (p instanceof CDAEntry) {
        CDAEntry pageEntry = (CDAEntry) p;
        tmp.pages.add(getPageForEntry(pageEntry));
      }
    }

    return tmp;
  } catch (RetrofitError e) {
    e.printStackTrace();
  }

  return null;
}
 
开发者ID:contentful,项目名称:discovery-app-android,代码行数:29,代码来源:TutorialLoader.java

示例7: getPageForEntry

import com.contentful.java.cda.CDAEntry; //导入方法依赖的package包/类
private static Tutorial.Page getPageForEntry(CDAEntry entry) {
  Tutorial.Page page = new Tutorial.Page();
  page.headline = entry.getField("headline");
  page.content = entry.getField("content");
  page.asset = entry.getField("asset");
  return page;
}
 
开发者ID:contentful,项目名称:discovery-app-android,代码行数:8,代码来源:TutorialLoader.java


注:本文中的com.contentful.java.cda.CDAEntry.getField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。