com.fasterxml.jackson.core.JsonPointer.equals()方法的使用及代码示例

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

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

JsonPointer.equals介绍

暂无

代码示例

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof JsonReference)) {
    return false;
  }
  JsonReference other = (JsonReference) obj;
  if (pointer == null) {
    if (other.pointer != null) {
      return false;
    }
  } else if (!pointer.equals(other.pointer)) {
    return false;
  }
  if (uri == null) {
    if (other.uri != null) {
      return false;
    }
  } else if (!uri.equals(other.uri)) {
    return false;
  }
  return true;
}

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

@Override
public boolean canProvideContentAssist(TypeDefinition type) {
  return type != null && pointer.equals(type.getPointer());
}

代码示例来源:origin: com.reprezen.jsonoverlay/jsonoverlay

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (getClass() != obj.getClass())
    return false;
  PropertyLocator other = (PropertyLocator) obj;
  if (name == null) {
    if (other.name != null)
      return false;
  } else if (!name.equals(other.name))
    return false;
  if (pointer == null) {
    if (other.pointer != null)
      return false;
  } else if (!pointer.equals(other.pointer))
    return false;
  if (vector == null) {
    if (other.vector != null)
      return false;
  } else if (!vector.equals(other.vector))
    return false;
  return true;
}

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

/**
 * Returns all the nodes whose type match the given pointer.
 * 
 * @param typePointer
 *            pointer of a type present in the schema
 * @return list of nodes being instance of the type
 */
public List<AbstractNode> findByType(JsonPointer typePointer) {
  List<AbstractNode> instances = new ArrayList<>();
  for (AbstractNode node : allNodes()) {
    if (node.getType() != null && typePointer.equals(node.getType().getPointer())) {
      instances.add(node);
    }
  }
  return instances;
}

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

/**
 * Returns the type of a node.
 * 
 * <br/>
 * 
 * Note: this method should be used only during initialization of a model.
 * 
 * @param node
 * @return node's type
 */
public TypeDefinition getType(AbstractNode node) {
  JsonPointer pointer = node.getPointer();
  if (JsonPointer.compile("").equals(pointer)) {
    return swaggerType.getType();
  }
  String[] paths = pointer.toString().substring(1).split("/");
  TypeDefinition current = swaggerType.getType();
  if (current != null) {
    for (String property : paths) {
      TypeDefinition next = current.getPropertyType(property);
      // not found, we stop here
      if (next == null) {
        break;
      }
      current = next;
    }
  }
  return current;
}

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

@Override
  JsonNode apply(final JsonNode node) {
    if (from.equals(path)) {
      return node;
    }
    if (node.at(from).isMissingNode()) {
      throw new JsonPatchException("non-existent source path: " + from);
    }

    final JsonNode sourceParent = ensureSourceParent(node, from);

    // Remove
    final String raw = from.last().getMatchingProperty();
    final JsonNode source;
    if (sourceParent.isObject()) {
      source = ((ObjectNode) sourceParent).remove(raw);
    } else {
      source = ((ArrayNode) sourceParent).remove(Integer.parseInt(raw));
    }

    // Add
    if (path.toString().isEmpty()) {
      return source;
    }

    final JsonNode targetParent = ensureTargetParent(node, path);
    return targetParent.isArray() ? AddOperation.addToArray(path, node, source)
                   : AddOperation.addToObject(path, node, source);
  }
}

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

@Override
  JsonNode apply(final JsonNode node) {
    if (from.equals(path)) {
      return node;
    }
    if (node.at(from).isMissingNode()) {
      throw new JsonPatchException("non-existent source path: " + from);
    }

    final JsonNode sourceParent = ensureSourceParent(node, from);

    // Remove
    final String raw = from.last().getMatchingProperty();
    final JsonNode source;
    if (sourceParent.isObject()) {
      source = ((ObjectNode) sourceParent).remove(raw);
    } else {
      source = ((ArrayNode) sourceParent).remove(Integer.parseInt(raw));
    }

    // Add
    if (path.toString().isEmpty()) {
      return source;
    }

    final JsonNode targetParent = ensureTargetParent(node, path);
    return targetParent.isArray() ? AddOperation.addToArray(path, node, source)
                   : AddOperation.addToObject(path, node, source);
  }
}

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

@Override
  JsonNode apply(final JsonNode node) {
    if (from.equals(path)) {
      return node;
    }
    if (node.at(from).isMissingNode()) {
      throw new JsonPatchException("non-existent source path: " + from);
    }

    final JsonNode sourceParent = ensureSourceParent(node, from);

    // Remove
    final String raw = from.last().getMatchingProperty();
    final JsonNode source;
    if (sourceParent.isObject()) {
      source = ((ObjectNode) sourceParent).remove(raw);
    } else {
      source = ((ArrayNode) sourceParent).remove(Integer.parseInt(raw));
    }

    // Add
    if (path.toString().isEmpty()) {
      return source;
    }

    final JsonNode targetParent = ensureTargetParent(node, path);
    return targetParent.isArray() ? AddOperation.addToArray(path, node, source)
                   : AddOperation.addToObject(path, node, source);
  }
}

相关文章