com.linecorp.centraldogma.internal.Jackson.textValue()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中com.linecorp.centraldogma.internal.Jackson.textValue()方法的一些代码示例,展示了Jackson.textValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jackson.textValue()方法的具体详情如下:
包路径:com.linecorp.centraldogma.internal.Jackson
类名称:Jackson
方法名:textValue

Jackson.textValue介绍

暂无

代码示例

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded

static Commit newCommit(Author author, long when, String jsonString) {
  requireNonNull(author, "author");
  when = when / 1000L * 1000L; // Drop the milliseconds
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    final String summary = Jackson.textValue(jsonNode.get(FIELD_NAME_SUMMARY), "");
    final String detail = Jackson.textValue(jsonNode.get(FIELD_NAME_DETAIL), "");
    final Markup markup;
    switch (Jackson.textValue(jsonNode.get(FIELD_NAME_MARKUP), "")) {
    case "plaintext":
      markup = Markup.PLAINTEXT;
      break;
    case "markdown":
      markup = Markup.MARKDOWN;
      break;
    default:
      markup = Markup.UNKNOWN;
    }
    final Revision revision = new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
    return new Commit(revision, author, when, summary, detail, markup);
  } catch (Exception e) {
    throw new StorageException("failed to create a Commit", e);
  }
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server

static Commit newCommit(Author author, long when, String jsonString) {
  requireNonNull(author, "author");
  when = when / 1000L * 1000L; // Drop the milliseconds
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    final String summary = Jackson.textValue(jsonNode.get(FIELD_NAME_SUMMARY), "");
    final String detail = Jackson.textValue(jsonNode.get(FIELD_NAME_DETAIL), "");
    final Markup markup;
    switch (Jackson.textValue(jsonNode.get(FIELD_NAME_MARKUP), "")) {
    case "plaintext":
      markup = Markup.PLAINTEXT;
      break;
    case "markdown":
      markup = Markup.MARKDOWN;
      break;
    default:
      markup = Markup.UNKNOWN;
    }
    final Revision revision = new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
    return new Commit(revision, author, when, summary, detail, markup);
  } catch (Exception e) {
    throw new StorageException("failed to create a Commit", e);
  }
}

代码示例来源:origin: line/centraldogma

static Commit newCommit(Author author, long when, String jsonString) {
  requireNonNull(author, "author");
  when = when / 1000L * 1000L; // Drop the milliseconds
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    final String summary = Jackson.textValue(jsonNode.get(FIELD_NAME_SUMMARY), "");
    final String detail = Jackson.textValue(jsonNode.get(FIELD_NAME_DETAIL), "");
    final Markup markup;
    switch (Jackson.textValue(jsonNode.get(FIELD_NAME_MARKUP), "")) {
    case "plaintext":
      markup = Markup.PLAINTEXT;
      break;
    case "markdown":
      markup = Markup.MARKDOWN;
      break;
    default:
      markup = Markup.UNKNOWN;
    }
    final Revision revision = new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
    return new Commit(revision, author, when, summary, detail, markup);
  } catch (Exception e) {
    throw new StorageException("failed to create a Commit", e);
  }
}

代码示例来源:origin: line/centraldogma

static Revision extractRevision(String jsonString) {
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    return new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
  } catch (Exception e) {
    throw new StorageException("failed to extract revision from " + jsonString, e);
  }
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded

static Revision extractRevision(String jsonString) {
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    return new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
  } catch (Exception e) {
    throw new StorageException("failed to extract revision from " + jsonString, e);
  }
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server

static Revision extractRevision(String jsonString) {
  try {
    final JsonNode jsonNode = Jackson.readTree(jsonString);
    return new Revision(Jackson.textValue(jsonNode.get(FIELD_NAME_REVISION), ""));
  } catch (Exception e) {
    throw new StorageException("failed to extract revision from " + jsonString, e);
  }
}

相关文章