Java Code Examples for com.google.common.base.MoreObjects#toStringHelper()

The following examples show how to use com.google.common.base.MoreObjects#toStringHelper() . 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: Block.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
@Override
public String toString()
{
    MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this);
    helper.add("rows", getRowCount());

    int rowsToPrint = this.vectorSchema.getRowCount() > 10 ? 10 : this.vectorSchema.getRowCount();
    for (Field next : this.schema.getFields()) {
        FieldReader thisReader = vectorSchema.getVector(next.getName()).getReader();
        List<String> values = new ArrayList<>();
        for (int i = 0; i < rowsToPrint; i++) {
            thisReader.setPosition(i);
            values.add(fieldToString(thisReader));
        }
        helper.add(next.getName(), values);
    }

    return helper.toString();
}
 
Example 2
Source File: MapMaker.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Returns a string representation for this MapMaker instance. The exact form of the returned
 * string is not specificed.
 */
@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  return s.toString();
}
 
Example 3
Source File: MapMaker.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Returns a string representation for this MapMaker instance. The exact form of the returned
 * string is not specificed.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  return s.toString();
}
 
Example 4
Source File: MapMaker.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Returns a string representation for this MapMaker instance. The exact form of the returned
 * string is not specificed.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  return s.toString();
}
 
Example 5
Source File: MapMaker.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Returns a string representation for this MapMaker instance. The exact form of the returned
 * string is not specificed.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  return s.toString();
}
 
Example 6
Source File: DefaultAggregatedHttpResponse.java    From armeria with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(this);

    if (!informationals().isEmpty()) {
        helper.add("informationals", informationals());
    }

    helper.add("headers", headers())
          .add("content", content());

    if (!trailers().isEmpty()) {
        helper.add("trailers", trailers());
    }

    return helper.toString();
}
 
Example 7
Source File: MapMaker.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Returns a string representation for this MapMaker instance. The exact form of the returned
 * string is not specificed.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  return s.toString();
}
 
Example 8
Source File: PropertyCodeGenerator.java    From FreeBuilder with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
  ToStringHelper stringHelper = MoreObjects.toStringHelper(this);
  for (Map.Entry<String, Object> fieldValue : fieldValues().entrySet()) {
    stringHelper.add(fieldValue.getKey(), fieldValue.getValue());
  }
  return stringHelper.toString();
}
 
Example 9
Source File: FilterCondition.java    From james-project with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper helper = MoreObjects.toStringHelper(getClass());
    inMailboxes.ifPresent(x -> helper.add("inMailboxes", x));
    notInMailboxes.ifPresent(x -> helper.add("notInMailboxes", x));
    before.ifPresent(x -> helper.add("before", x));
    after.ifPresent(x -> helper.add("after", x));
    minSize.ifPresent(x -> helper.add("minSize", x));
    maxSize.ifPresent(x -> helper.add("maxSize", x));
    isFlagged.ifPresent(x -> helper.add("isFlagged", x));
    isUnread.ifPresent(x -> helper.add("isUnread", x));
    isAnswered.ifPresent(x -> helper.add("isAnswered", x));
    isDraft.ifPresent(x -> helper.add("isDraft", x));
    isForwarded.ifPresent(x -> helper.add("isForwarded", x));
    hasAttachment.ifPresent(x -> helper.add("hasAttachment", x));
    text.ifPresent(x -> helper.add("text", x));
    from.ifPresent(x -> helper.add("from", x));
    to.ifPresent(x -> helper.add("to", x));
    cc.ifPresent(x -> helper.add("cc", x));
    bcc.ifPresent(x -> helper.add("bcc", x));
    subject.ifPresent(x -> helper.add("subject", x));
    body.ifPresent(x -> helper.add("body", x));
    attachments.ifPresent(x -> helper.add("attachments", x));
    header.ifPresent(x -> helper.add("header", x));
    hasKeyword.ifPresent(x -> helper.add("hasKeyword", x));
    notKeyword.ifPresent(x -> helper.add("notKeyword", x));
    attachmentFileName.ifPresent(x -> helper.add("attachmentFileName", x));
    return helper.toString();
}
 
Example 10
Source File: Endpoint.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(this);
    helper.addValue(authority());
    if (hostType == HostType.HOSTNAME_AND_IPv4 ||
        hostType == HostType.HOSTNAME_AND_IPv6) {
        helper.add("ipAddr", ipAddr);
    }
    helper.add("weight", weight);
    return helper.toString();
}
 
Example 11
Source File: CacheBuilder.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Returns a string representation for this CacheBuilder instance. The exact form of the returned
 * string is not specified.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (maximumSize != UNSET_INT) {
    s.add("maximumSize", maximumSize);
  }
  if (maximumWeight != UNSET_INT) {
    s.add("maximumWeight", maximumWeight);
  }
  if (expireAfterWriteNanos != UNSET_INT) {
    s.add("expireAfterWrite", expireAfterWriteNanos + "ns");
  }
  if (expireAfterAccessNanos != UNSET_INT) {
    s.add("expireAfterAccess", expireAfterAccessNanos + "ns");
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  if (valueEquivalence != null) {
    s.addValue("valueEquivalence");
  }
  if (removalListener != null) {
    s.addValue("removalListener");
  }
  return s.toString();
}
 
Example 12
Source File: CacheBuilder.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
* Returns a string representation for this CacheBuilder instance. The exact form of the returned
* string is not specified.
*/

 @Override
 public String toString() {
 MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
 if (initialCapacity != UNSET_INT) {
            s.add("initialCapacity", initialCapacity);
 }
 if (concurrencyLevel != UNSET_INT) {
            s.add("concurrencyLevel", concurrencyLevel);
 }
 if (maximumSize != UNSET_INT) {
            s.add("maximumSize", maximumSize);
 }
 if (maximumWeight != UNSET_INT) {
            s.add("maximumWeight", maximumWeight);
 }
 if (expireAfterWriteNanos != UNSET_INT) {
            s.add("expireAfterWrite", expireAfterWriteNanos + "ns");
 }
 if (expireAfterAccessNanos != UNSET_INT) {
            s.add("expireAfterAccess", expireAfterAccessNanos + "ns");
 }
 if (keyStrength != null) {
            s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
 }
 if (valueStrength != null) {
            s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
 }
 if (keyEquivalence != null) {
            s.addValue("keyEquivalence");
 }
 if (valueEquivalence != null) {
            s.addValue("valueEquivalence");
 }
 if (removalListener != null) {
            s.addValue("removalListener");
 }
 return s.toString();
 }
 
Example 13
Source File: CacheBuilder.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Returns a string representation for this CacheBuilder instance. The exact form of the returned
 * string is not specified.
 */

@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (maximumSize != UNSET_INT) {
    s.add("maximumSize", maximumSize);
  }
  if (maximumWeight != UNSET_INT) {
    s.add("maximumWeight", maximumWeight);
  }
  if (expireAfterWriteNanos != UNSET_INT) {
    s.add("expireAfterWrite", expireAfterWriteNanos + "ns");
  }
  if (expireAfterAccessNanos != UNSET_INT) {
    s.add("expireAfterAccess", expireAfterAccessNanos + "ns");
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  if (valueEquivalence != null) {
    s.addValue("valueEquivalence");
  }
  if (removalListener != null) {
    s.addValue("removalListener");
  }
  return s.toString();
}
 
Example 14
Source File: DefaultAggregatedHttpRequest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(this);

    helper.add("headers", headers())
          .add("content", content());

    if (!trailers().isEmpty()) {
        helper.add("trailers", trailers());
    }

    return helper.toString();
}
 
Example 15
Source File: CacheBuilder.java    From bazel-buildfarm with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a string representation for this CacheBuilder instance. The exact form of the returned
 * string is not specified.
 */
@Override
public String toString() {
  MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
  if (initialCapacity != UNSET_INT) {
    s.add("initialCapacity", initialCapacity);
  }
  if (concurrencyLevel != UNSET_INT) {
    s.add("concurrencyLevel", concurrencyLevel);
  }
  if (maximumSize != UNSET_INT) {
    s.add("maximumSize", maximumSize);
  }
  if (maximumWeight != UNSET_INT) {
    s.add("maximumWeight", maximumWeight);
  }
  if (expireAfterWriteNanos != UNSET_INT) {
    s.add("expireAfterWrite", expireAfterWriteNanos + "ns");
  }
  if (expireAfterAccessNanos != UNSET_INT) {
    s.add("expireAfterAccess", expireAfterAccessNanos + "ns");
  }
  if (keyStrength != null) {
    s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
  }
  if (valueStrength != null) {
    s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
  }
  if (keyEquivalence != null) {
    s.addValue("keyEquivalence");
  }
  if (valueEquivalence != null) {
    s.addValue("valueEquivalence");
  }
  if (removalListener != null) {
    s.addValue("removalListener");
  }
  return s.toString();
}
 
Example 16
Source File: Cleaner.java    From exonum-java-binding with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a string representation of this object, including its hash code so that this instance
 * can be easily identified in the logs.
 */
@Override
public String toString() {
  String hash = Integer.toHexString(System.identityHashCode(this));
  MoreObjects.ToStringHelper sb = MoreObjects.toStringHelper(this);
  sb.add("hash", hash);
  if (!description.isEmpty()) {
    sb.add("description", description);
  }
  return sb
      .add("numRegisteredActions", getNumRegisteredActions())
      .add("closed", closed)
      .toString();
}
 
Example 17
Source File: Routing.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this);
    helper.add("locations", locations);
    return helper.toString();

}
 
Example 18
Source File: WhereClause.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this);
    if (noMatch()) {
        helper.add("NO_MATCH", true);
    } else if (!hasQuery()) {
        helper.add("MATCH_ALL", true);
    } else {
        helper.add("query", query);
    }
    return helper.toString();
}
 
Example 19
Source File: AbstractMirrorCredential.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
@Override
public final String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(this);
    if (id != null) {
        helper.add("id", id);
    }
    if (!hostnamePatterns.isEmpty()) {
        helper.add("hostnamePatterns", hostnamePatterns);
    }

    addProperties(helper);
    return helper.toString();
}
 
Example 20
Source File: Key.java    From scalardb with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
  MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this);
  values.forEach(v -> helper.addValue(v));
  return helper.toString();
}