org.apache.kafka.common.utils.Utils.join()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(193)

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

Utils.join介绍

[英]Create a string representation of a list joined by the given separator
[中]创建由给定分隔符连接的列表的字符串表示形式

代码示例

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(name=" + name + ", internal=" + internal + ", partitions=" +
      Utils.join(partitions, ",") + ")";
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(topicPartitions=" + Utils.join(topicPartitions, ",") + ")";
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(type=DeleteAclsRequest, filters=" + Utils.join(filters, ", ") + ")";
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(type=PartitionMetadata" +
        ", error=" + error +
        ", partition=" + partition +
        ", leader=" + leader +
        ", leaderEpoch=" + leaderEpoch +
        ", replicas=" + Utils.join(replicas, ",") +
        ", isr=" + Utils.join(isr, ",") +
        ", offlineReplicas=" + Utils.join(offlineReplicas, ",") + ')';
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(error=" + error + ", deletions=" + Utils.join(deletions, ",") + ")";
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(type=DescribeGroupsRequest, groupIds=(" + Utils.join(groupIds, ",") + "))";
  }
}

代码示例来源:origin: apache/kafka

@Override
public String toString() {
  return "PartitionState(controllerEpoch=" + basePartitionState.controllerEpoch +
    ", leader=" + basePartitionState.leader +
    ", leaderEpoch=" + basePartitionState.leaderEpoch +
    ", isr=" + Utils.join(basePartitionState.isr, ",") +
    ", zkVersion=" + basePartitionState.zkVersion +
    ", replicas=" + Utils.join(basePartitionState.replicas, ",") +
    ", isNew=" + isNew + ")";
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(groupId=" + groupId +
      ", isSimpleConsumerGroup=" + isSimpleConsumerGroup +
      ", members=" + Utils.join(members, ",") +
      ", partitionAssignor=" + partitionAssignor +
      ", state=" + state +
      ", coordinator=" + coordinator +
      ")";
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    return "(type=CreateAclsRequest, creations=" + Utils.join(creations, ", ") + ")";
  }
}

代码示例来源:origin: apache/kafka

public String toString() {
  return "(partition=" + partition + ", leader=" + leader + ", replicas=" +
    Utils.join(replicas, ", ") + ", isr=" + Utils.join(isr, ", ") + ")";
}

代码示例来源:origin: apache/kafka

public String toString() {
    return "[" + Utils.join(validStrings, ", ") + "]";
  }
}

代码示例来源:origin: apache/kafka

/**
 * Create a string representation of an array joined by the given separator
 * @param strs The array of items
 * @param separator The separator
 * @return The string representation.
 */
public static <T> String join(T[] strs, String separator) {
  return join(Arrays.asList(strs), separator);
}

代码示例来源:origin: apache/kafka

@Override
public String toString() {
  return "JoinGroupResponse" +
    "(throttleTimeMs=" + throttleTimeMs +
    ", error=" + error +
    ", generationId=" + generationId +
    ", groupProtocol=" + groupProtocol +
    ", memberId=" + memberId +
    ", leaderId=" + leaderId +
    ", members=" + ((members == null) ? "null" :
      Utils.join(members.keySet(), ",")) + ")";
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    StringBuilder bld = new StringBuilder();
    bld.append("(type=DeleteGroupsRequest").
      append(", groups=(").append(Utils.join(groups, ", ")).append(")").
      append(")");
    return bld.toString();
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    StringBuilder bld = new StringBuilder();
    bld.append("(type=DeleteTopicsRequest").
      append(", topics=(").append(Utils.join(topics, ", ")).append(")").
      append(", timeout=").append(timeout).
      append(")");
    return bld.toString();
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    StringBuilder bld = new StringBuilder();
    String partitionsString = partitions == null ? "<ALL>" : Utils.join(partitions, ",");
    bld.append("(type=OffsetFetchRequest, ").
        append("groupId=").append(groupId).
        append(", partitions=").append(partitionsString).
        append(")");
    return bld.toString();
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    StringBuilder bld = new StringBuilder();
    bld.append("(type=SyncGroupRequest").
        append(", groupId=").append(groupId).
        append(", generationId=").append(generationId).
        append(", memberId=").append(memberId).
        append(", groupAssignment=").
        append(Utils.join(groupAssignment.keySet(), ",")).
        append(")");
    return bld.toString();
  }
}

代码示例来源:origin: apache/kafka

@Override
  public String toString() {
    StringBuilder bld = new StringBuilder();
    bld.append("(type=LeaderAndIsRequest")
      .append(", controllerId=").append(controllerId)
      .append(", controllerEpoch=").append(controllerEpoch)
      .append(", brokerEpoch=").append(brokerEpoch)
      .append(", partitionStates=").append(partitionStates)
      .append(", liveLeaders=(").append(Utils.join(liveLeaders, ", ")).append(")")
      .append(")");
    return bld.toString();
  }
}

代码示例来源:origin: apache/kafka

@Override
public void ensureValid(String name, Object o) {
  String s = (String) o;
  if (!validStrings.contains(s)) {
    throw new ConfigException(name, o, "String must be one of: " + Utils.join(validStrings, ", "));
  }
}

代码示例来源:origin: apache/kafka

@Test
public void testJoin() {
  assertEquals("", Utils.join(Collections.emptyList(), ","));
  assertEquals("1", Utils.join(Arrays.asList("1"), ","));
  assertEquals("1,2,3", Utils.join(Arrays.asList(1, 2, 3), ","));
}

相关文章