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

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

    if (type == 1) {
        helper.add("stringValue", value);
    }
    else if (type == 2) {
        helper.add("longValue", value);
    }
    else if (type == 3) {
        helper.add("fruitValue", value);
    }
    return helper.toString();
}
 
Example 2
Source File: RouteMatch.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
  ToStringHelper toStringHelper =
      MoreObjects.toStringHelper(this).add("name", name);
  if (exactMatch != null) {
    toStringHelper.add("exactMatch", exactMatch);
  }
  if (safeRegExMatch != null) {
    toStringHelper.add("safeRegExMatch", safeRegExMatch.pattern());
  }
  if (rangeMatch != null) {
    toStringHelper.add("rangeMatch", rangeMatch);
  }
  if (presentMatch != null) {
    toStringHelper.add("presentMatch", presentMatch);
  }
  if (prefixMatch != null) {
    toStringHelper.add("prefixMatch", prefixMatch);
  }
  if (suffixMatch != null) {
    toStringHelper.add("suffixMatch", suffixMatch);
  }
  return toStringHelper.add("isInvertedMatch", isInvertedMatch).toString();
}
 
Example 3
Source File: RepositoryDto.java    From centraldogma with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper stringHelper = MoreObjects.toStringHelper(this)
                                                   .add("name", name());
    if (creator() != null) {
        stringHelper.add("creator", creator());
    }

    if (headRevision() != null) {
        stringHelper.add("headRevision", headRevision());
    }

    if (createdAt() != null) {
        stringHelper.add("createdAt", createdAt());
    }

    return stringHelper.toString();
}
 
Example 4
Source File: MutableDocumentFieldChangedEvent.java    From metasfresh-webui-api-legacy with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toString()
{
	final ToStringHelper helper = MoreObjects.toStringHelper(this)
			.omitNullValues()
			.add("documentPath", documentPath)
			.add("fieldName", fieldName);

	if (valueSet)
	{
		helper.add("value", value == null ? "<NULL>" : value);
	}

	return helper.toString();
}
 
Example 5
Source File: PcepStateReportVer1.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());

    if (attrList != null) {
        toStrHelper.add("AttributeList", attrList);
    }
    if (rroObj instanceof PcepRroObjectVer1) {
        toStrHelper.add("RroObject", rroObj);
    }
    if (bandwidth instanceof PcepBandwidthObjectVer1) {
        toStrHelper.add("bandwidthObject", bandwidth);
    }
    return toStrHelper.toString();
}
 
Example 6
Source File: Identity.java    From copybara with Apache License 2.0 5 votes vote down vote up
public static String hashIdentity(ToStringHelper helper, String workflowIdentityUser) {
  helper.add(
      "user",
      workflowIdentityUser != null
          ? workflowIdentityUser
          : StandardSystemProperty.USER_NAME.value());
  String identity = helper.toString();
  String hash =
      BaseEncoding.base16()
          .encode(Hashing.md5().hashString(identity, StandardCharsets.UTF_8).asBytes());
  // Important to log the source of the hash and the hash for debugging purposes.
  logger.atInfo().log("Computed migration identity hash for %s as %s ", identity, hash);
  return hash;
}
 
Example 7
Source File: BestPathStateImpl.java    From bgpcep with Eclipse Public License 1.0 5 votes vote down vote up
private ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
    toStringHelper.add("attributes", this.attributes);
    toStringHelper.add("localPref", this.localPref);
    toStringHelper.add("multiExitDisc", this.multiExitDisc);
    toStringHelper.add("origin", this.origin);
    toStringHelper.add("resolved", this.resolved);
    toStringHelper.add("depreferenced", this.depreferenced);
    return toStringHelper;
}
 
Example 8
Source File: IPv6NeighborAddressSubTlv.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());

    toStrHelper.add("Type", TYPE);
    toStrHelper.add("Length", LENGTH);

    StringBuffer result = new StringBuffer();
    for (byte b : rawValue) {
        result.append(String.format("%02X ", b));
    }
    toStrHelper.add("Value", result);

    return toStrHelper.toString();
}
 
Example 9
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 10
Source File: IgpRouterIdSubTlv.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());

    toStrHelper.add("Type", TYPE);
    toStrHelper.add("Length", hLength);

    StringBuffer result = new StringBuffer();
    for (byte b : rawValue) {
        result.append(String.format("%02X ", b));
    }
    toStrHelper.add("Value", result);

    return toStrHelper.toString();
}
 
Example 11
Source File: NodeNameSubTlv.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());

    toStrHelper.add("Type", TYPE);
    toStrHelper.add("Length", hLength);

    StringBuffer result = new StringBuffer();
    for (byte b : rawValue) {
        result.append(String.format("%02X ", b));
    }
    toStrHelper.add("Value", result);

    return toStrHelper.toString();
}
 
Example 12
Source File: HumanReadables.java    From android-test with Apache License 2.0 4 votes vote down vote up
private static void innerDescribe(ViewGroup viewGroup, ToStringHelper helper) {
  helper.add("child-count", viewGroup.getChildCount());
}
 
Example 13
Source File: ResourceYinTextSchemaSource.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
    return toStringHelper.add("url", url);
}
 
Example 14
Source File: AbstractIdentifiable.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
    return toStringHelper.add("identifier", getIdentifier());
}
 
Example 15
Source File: DocumentFieldChange.java    From metasfresh-webui-api-legacy with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString()
{
	final ToStringHelper toStringBuilder = MoreObjects.toStringHelper(this)
			.omitNullValues()
			.add("fieldName", fieldName)
			.add("key", key ? Boolean.TRUE : null)
			.add("privateField", !publicField ? Boolean.TRUE : null)
			.add("advancedField", advancedField ? Boolean.TRUE : null)
			.add("widgetType", widgetType)
			.add("validStatus", validStatus);
	if (valueSet)
	{
		toStringBuilder.add("value", value == null ? "<NULL>" : value);
		toStringBuilder.add("valueReason", valueReason);
	}
	if (readonly != null)
	{
		toStringBuilder.add("readonly", readonly);
		toStringBuilder.add("readonlyReason", readonlyReason);
	}
	if (mandatory != null)
	{
		toStringBuilder.add("mandatory", mandatory);
		toStringBuilder.add("mandatoryReason", mandatoryReason);
	}
	if (displayed != null)
	{
		toStringBuilder.add("displayed", displayed);
		toStringBuilder.add("displayedReason", displayedReason);
	}
	if (lookupValuesStale != null)
	{
		toStringBuilder.add("lookupValuesStale", lookupValuesStale);
		toStringBuilder.add("lookupValuesStaleReason", lookupValuesStaleReason);
	}

	if (debugProperties != null && !debugProperties.isEmpty())
	{
		toStringBuilder.add("debugProperties", debugProperties);
	}

	return toStringBuilder.toString();
}
 
Example 16
Source File: SimpleContainerNode.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
    return helper.add("data", getData());
}
 
Example 17
Source File: DelegatedYangTextSchemaSource.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
    return toStringHelper.add("delegate", delegate);
}
 
Example 18
Source File: SimpleSchemaContext.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
    return toStringHelper.add("modules", modules);
}
 
Example 19
Source File: ValueNode.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
    return helper.add("value", getData());
}
 
Example 20
Source File: ParsedPathExpression.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
    return super.addToStringAttributes(helper.add("steps", steps));
}