org.infinispan.commons.util.Util.toStr()方法的使用及代码示例

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

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

Util.toStr介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-commons

/**
*
* Prints {@link Subject}'s principals as a one-liner
* (as opposed to default Subject's <code>toString()</code> method, which prints every principal on separate line).
*
*/
public static String prettyPrintSubject(Subject subject) {
 return (subject == null) ? "null" : "Subject with principal(s): " + toStr(subject.getPrincipals());
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

@Override
public String toString() {
  return "KeyWithVersionEvent{" +
     "version=" + version +
     ", messageId=" + messageId +
     ", op=" + op +
     ", listenerId=" + Util.printArray(listenerId, false) +
     ", isRetried=" + isRetried +
     ", key=" + Util.toStr(key) +
     ", dataVersion=" + dataVersion +
     '}';
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

@Override
public String toString() {
  return "CustomEvent{" +
     "version=" + version +
     ", messageId=" + messageId +
     ", op=" + op +
     ", listenerId=" + Util.printArray(listenerId, false) +
     ", isRetried=" + isRetried +
     ", event=" + Util.toStr(eventData) +
     '}';
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

@Override
public String toString() {
  return "KeyEvent{" +
     "version=" + version +
     ", messageId=" + messageId +
     ", op=" + op +
     ", listenerId=" + Util.printArray(listenerId, false) +
     ", isRetried=" + isRetried +
     ", key=" + Util.toStr(key) +
     '}';
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

@Override
public String toString() {
  return "CustomRawEvent{" +
     "version=" + version +
     ", messageId=" + messageId +
     ", op=" + op +
     ", listenerId=" + Util.printArray(listenerId, false) +
     ", isRetried=" + isRetried +
     ", event=" + Util.toStr(eventData) +
     '}';
}

代码示例来源:origin: org.infinispan/infinispan-commons

public static <E> String toStr(Collection<E> collection) {
 if (collection == null)
   return "[]";
 Iterator<E> i = collection.iterator();
 if (!i.hasNext())
   return "[]";
 StringBuilder sb = new StringBuilder();
 sb.append('[');
 for (int counter = 0;;) {
   E e = i.next();
   sb.append(e == collection ? "(this Collection)" : toStr(e));
   if (! i.hasNext())
    return sb.append(']').toString();
   if (++counter >= COLLECTIONS_LIMIT) {
    return sb.append("...<")
       .append(collection.size() - COLLECTIONS_LIMIT)
       .append(" other elements>]").toString();
   }
   sb.append(", ");
 }
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-rest

@Override
  public void run() {
   try {
     cache.get(key);
     int i = count.getAndIncrement();
     if (log.isDebugEnabled() && i % 100 == 0)
      log.debugf(">>    Moved %s keys\n", i);
   } catch (Exception e) {
     if ((key instanceof String) && ((String) key).matches("___MigrationManager_.+_KnownKeys___")) {
      // ISPN-3724 Ignore keys from other migrators.
     } else {
      log.keyMigrationFailed(Util.toStr(key), e);
     }
   }
  }
});

代码示例来源:origin: org.infinispan/infinispan-core

public void testByteArrayGet() {
   Map<byte[], byte[]> map = cache();
   byte[] key = {1, 2, 3};
   byte[] value = {4, 5, 6};
   map.put(key, value);
   byte[] lookupKey = {1, 2, 3}; // on purpose, different instance required
   assertTrue(String.format("Expected key=%s to return value=%s",
      Util.toStr(lookupKey), Util.toStr(value)),
      Arrays.equals(value, map.get(lookupKey)));
  }
}

相关文章