org.onosproject.net.Annotations.keys()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(150)

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

Annotations.keys介绍

暂无

代码示例

代码示例来源:origin: org.onosproject/onos-apps-optical-model

@Override
public Set<String> keys() {
  return Sets.difference(delegate.keys(), filtered);
}

代码示例来源:origin: org.onosproject/onos-cli

/**
 * Produces a JSON object from the specified key/value annotations.
 *
 * @param mapper      ObjectMapper to use while converting to JSON
 * @param annotations key/value annotations
 * @return JSON object
 */
public static ObjectNode annotations(ObjectMapper mapper, Annotations annotations) {
  ObjectNode result = mapper.createObjectNode();
  for (String key : annotations.keys()) {
    result.put(key, annotations.value(key));
  }
  return result;
}

代码示例来源:origin: org.onosproject/onos-lldp-provider

private boolean containsSuppressionAnnotation(final Annotations annotations) {
  for (Entry<String, String> entry : suppressedAnnotation.entrySet()) {
    final String suppValue = entry.getValue();
    final String suppKey = entry.getKey();
    if (suppValue == ANY_VALUE) {
      if (annotations.keys().contains(suppKey)) {
        return true;
      }
    } else {
      if (suppValue.equals(annotations.value(suppKey))) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.onosproject/onos-cli

/**
 * Produces a string image of the specified key/value annotations.
 *
 * @param annotations key/value annotations
 * @return string image with ", k1=v1, k2=v2, ..." pairs
 */
public static String annotations(Annotations annotations) {
  if (annotations == null) {
    annotations = DefaultAnnotations.EMPTY;
  }
  StringBuilder sb = new StringBuilder();
  Set<String> keys = new TreeSet<>(annotations.keys());
  for (String key : keys) {
    sb.append(", ").append(key).append('=').append(annotations.value(key));
  }
  return sb.toString();
}

代码示例来源:origin: org.onosproject/onos-cli

/**
 * Produces a string image of the specified key/value annotations.
 * Excludes the keys in the given Set.
 *
 * @param annotations  key/value annotations
 * @param excludedKeys keys not to add in the resulting string
 * @return string image with ", k1=v1, k2=v2, ..." pairs
 */
public static String annotations(Annotations annotations, Set<String> excludedKeys) {
  StringBuilder sb = new StringBuilder();
  Set<String> keys = new TreeSet<>(annotations.keys());
  keys.removeAll(excludedKeys);
  for (String key : keys) {
    sb.append(", ").append(key).append('=').append(annotations.value(key));
  }
  return sb.toString();
}

代码示例来源:origin: org.onosproject/onos-core-common

@Override
public ObjectNode encode(Annotations annotations, CodecContext context) {
  ObjectNode result = context.mapper().createObjectNode();
  Set<String> keys = new TreeSet<>(annotations.keys());
  for (String key : keys) {
    result.put(key, annotations.value(key));
  }
  return result;
}

代码示例来源:origin: org.onosproject/onos-core-net

private DomainId getAnnotatedDomainId(Device device) {
    if (!device.annotations().keys().contains(DOMAIN_ID)) {
      return DomainId.LOCAL;
    } else {
      return DomainId.domainId(
          device.annotations().value(DOMAIN_ID));
    }
  }
}

代码示例来源:origin: org.onosproject/onos-core-common

/**
 * Adds JSON encoding of the given item annotations to the specified node.
 *
 * @param node    node to add annotations to
 * @param entity  annotated entity
 * @param context encode context
 * @return the given node
 */
protected ObjectNode annotate(ObjectNode node, T entity, CodecContext context) {
  if (!entity.annotations().keys().isEmpty()) {
    JsonCodec<Annotations> codec = context.codec(Annotations.class);
    node.set("annotations", codec.encode(entity.annotations(), context));
  }
  return node;
}

相关文章