com.fasterxml.jackson.databind.node.TextNode.asText()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(131)

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

TextNode.asText介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<?> userLogout(@RequestBody final TextNode input) {
  System.out.println(input.asText());
  return new ResponseEntity<>("OK", HttpStatus.OK);
}

代码示例来源:origin: org.opensingular/singular-server-commons

@Override
public Icon deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
  TreeNode jsonNode = p.getCodec().readTree(p);
  String   cssClass = ((TextNode) jsonNode.get("cssClass")).asText();
  return () -> cssClass;
}

代码示例来源:origin: org.opensingular/singular-requirement-commons

@Override
public Icon deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
  TreeNode jsonNode = p.getCodec().readTree(p);
  String   cssClass = ((TextNode) jsonNode.get("cssClass")).asText();
  return () -> cssClass;
}

代码示例来源:origin: spotify/java-hamcrest

public static Matcher<JsonNode> jsonText(final TextNode value) {
 return jsonText(value.asText());
}

代码示例来源:origin: org.opensingular/singular-requirement-module

@Override
public Icon deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
  TreeNode jsonNode = p.getCodec().readTree(p);
  String   cssClass = ((TextNode) jsonNode.get("cssClass")).asText();
  return () -> cssClass;
}

代码示例来源:origin: io.swagger/swagger-parser

public RefResponse refResponse(TextNode obj, String location, ParseResult result) {
  return new RefResponse(obj.asText());
}

代码示例来源:origin: spotify/java-hamcrest

@Override
protected boolean matchesNode(TextNode node, Description mismatchDescription) {
 final String value = node.asText();
 if (textMatcher.matches(value)) {
  return true;
 } else {
  mismatchDescription.appendText("was a text node with value that ");
  textMatcher.describeMismatch(value, mismatchDescription);
  return false;
 }
}

代码示例来源:origin: HuygensING/timbuctoo

@Override
 public MediaType deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
  throws IOException {
  TextNode node = jsonParser.getCodec().readTree(jsonParser);

  return MediaType.valueOf(node.asText());
 }
}

代码示例来源:origin: org.eclipse.che.infrastructure.docker/docker-environment

private List<String> toCommand(ArrayNode arrayCommandNode, DeserializationContext ctxt)
   throws JsonMappingException {
  List<String> commands = new ArrayList<>();

  for (TreeNode treeNode : arrayCommandNode) {
   if (treeNode instanceof TextNode) {
    TextNode textNode = (TextNode) treeNode;
    commands.add(textNode.asText());
   } else {
    throw ctxt.mappingException("Array 'command' contains not string element.");
   }
  }

  return commands;
 }
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-store

private String value(TreeNode node) throws IOException, JsonParseException {
  TextNode value = (TextNode) node.get(QUOTA_ROOT_VALUE_FIELD);
  return value.asText();
}

代码示例来源:origin: io.swagger/swagger-parser

public RefParameter refParameter(TextNode obj, String location, ParseResult result) {
  return new RefParameter(obj.asText());
}

代码示例来源:origin: stackoverflow.com

TextNode surname = (TextNode) tree.path("surname");
return forenames.asText() + ":" + surname.asText();

代码示例来源:origin: benmfaul/XRTB

TextNode test = null;
if (country != null) {
  test = cache.get(country.asText());
  if (test == null) {
    String iso3 = isoMap.query(country.asText());
    test = new TextNode(iso3);

代码示例来源:origin: stackoverflow.com

final String roleName = roleNode.asText();
final String roleId = roleIdNode.asText();
final RoleInfo roleInfo = new RoleInfo(roleName, roleId);
final String username = usernameNode.asText();
final String userId = idNode.asText();

代码示例来源:origin: io.swagger/swagger-parser

public String getString(JsonNode node, String location, ParseResult result) {
  String output = null;
  if(!node.getNodeType().equals(JsonNodeType.STRING)) {
    result.invalidType(location, "", "string", node);
  }
  else {
    output = ((TextNode) node).asText();
  }
  return output;
}

代码示例来源:origin: org.eclipse.che.infrastructure.docker/docker-environment

/**
 * Parse command field from the compose yaml file to list command words.
 *
 * @param jsonParser json parser
 * @param ctxt deserialization context
 * @throws IOException in case I/O error. For example element to parsing contains invalid yaml
 *     field type defined for this field by yaml document model.
 * @throws JsonProcessingException
 */
@Override
public List<String> deserialize(JsonParser jsonParser, DeserializationContext ctxt)
  throws IOException {
 TreeNode tree = jsonParser.readValueAsTree();
 if (tree.isArray()) {
  return toCommand((ArrayNode) tree, ctxt);
 }
 if (tree instanceof TextNode) {
  TextNode textNode = (TextNode) tree;
  return asList(textNode.asText().trim().split(SPLIT_COMMAND_REGEX));
 }
 throw ctxt.mappingException(
   (format("Field '%s' must be simple text or string array.", jsonParser.getCurrentName())));
}

代码示例来源:origin: io.gs2/gs2-java-sdk-core

message = ((TextNode)json.get("message")).asText();
} catch (Exception e) {}

代码示例来源:origin: com.arakelian/jackson-utils

final String v = text.asText("");
return of(v);

代码示例来源:origin: com.arakelian/jackson-utils

final String v = text.asText("");
return of(v);

相关文章