Java Code Examples for com.google.common.primitives.UnsignedLongs#toString()

The following examples show how to use com.google.common.primitives.UnsignedLongs#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextFormatGetterTest.java    From heroic with Apache License 2.0 6 votes vote down vote up
@Test
public void testSpan () throws Exception {

  Random random = new Random(1234);
  SpanId generateSpanId = SpanId.generateRandomId(random);
  String spanId = UnsignedLongs.toString(spanIdToLong(generateSpanId));
  String traceId = TraceId.generateRandomId(random).toLowerBase16();

  final List<String> headers = new ArrayList<>();
  headers.add(traceId + "/" + spanId + ";o=1");
  doReturn(headers).when(request).getRequestHeader("X-Cloud-Trace-Context");

  final SpanContext spanContext = textFormat.extract(request, textFormatGetter);

  assertEquals(generateSpanId, spanContext.getSpanId());
}
 
Example 2
Source File: MNumericCastBase.java    From sql-layer with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void doEvaluate(TExecutionContext context, ValueSource source, ValueTarget target)
{
    String asString = UnsignedLongs.toString(source.getInt64());
    target.putObject(new BigDecimalWrapperImpl(asString));
}
 
Example 3
Source File: MNumeric.java    From sql-layer with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeCollating(ValueSource in, TInstance typeInstance, ValueTarget out) {
    String asString = UnsignedLongs.toString(in.getInt64());
    BigInteger asBigint = new BigInteger(asString);
    out.putObject(asBigint);
}
 
Example 4
Source File: MemoId.java    From java-stellar-sdk with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
  return UnsignedLongs.toString(this.id);
}
 
Example 5
Source File: OpTime.java    From mongowp with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
  return "{t: " + timestamp + ", i: " + UnsignedLongs.toString(term) + "}";
}
 
Example 6
Source File: PortNumber.java    From onos with Apache License 2.0 4 votes vote down vote up
private PortNumber(long number) {
    this.number = number;
    this.name = UnsignedLongs.toString(number);
    this.hasName = false;
}
 
Example 7
Source File: SpanId.java    From cloud-trace-java with Apache License 2.0 2 votes vote down vote up
/**
 * Returns this span id formatted as an unsigned long integer.
 *
 * @return The span identifier formatted for API consumption.
 */
public String getApiString() {
  return UnsignedLongs.toString(spanId);
}