Java Code Examples for com.google.common.base.MoreObjects.ToStringHelper

The following examples show how to use com.google.common.base.MoreObjects.ToStringHelper. These examples are extracted from open source projects. 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 Project: centraldogma   Source File: AbstractMirror.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper("")
                                             .add("schedule", CronDescriptor.instance().describe(schedule))
                                             .add("direction", direction)
                                             .add("localProj", localRepo.parent().name())
                                             .add("localRepo", localRepo.name())
                                             .add("localPath", localPath)
                                             .add("remoteRepo", remoteRepoUri)
                                             .add("remotePath", remotePath);
    if (remoteBranch != null) {
        helper.add("remoteBranch", remoteBranch);
    }

    helper.add("credential", credential);

    return helper.toString();
}
 
Example 2
Source Project: android-test   Source File: HumanReadables.java    License: Apache License 2.0 6 votes vote down vote up
private static void innerDescribe(TextView textBox, ToStringHelper helper) {
  if (null != textBox.getText()) {
    helper.add("text", textBox.getText());
  }

  if (null != textBox.getError()) {
    helper.add("error-text", textBox.getError());
  }

  if (null != textBox.getHint()) {
    helper.add("hint", textBox.getHint());
  }

  helper.add("input-type", textBox.getInputType());
  helper.add("ime-target", textBox.isInputMethodTarget());
  helper.add("has-links", textBox.getUrls().length > 0);
}
 
Example 3
Source Project: centraldogma   Source File: RepositoryDto.java    License: 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 Project: armeria   Source File: BackoffSpec.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper stringHelper = MoreObjects.toStringHelper(this)
                                                   .add("specification", specification);
    if (baseOption == BaseOption.fixed) {
        stringHelper.add("fixedDelayMillis", fixedDelayMillis);
    } else if (baseOption == BaseOption.random) {
        stringHelper.add("randomMinDelayMillis", randomMinDelayMillis)
                    .add("randomMaxDelayMillis", randomMaxDelayMillis);
    } else {
        stringHelper.add("initialDelayMillis", initialDelayMillis).add("maxDelayMillis", maxDelayMillis)
                    .add("multiplier", multiplier);
    }

    stringHelper.add("minJitterRate", minJitterRate).add("maxJitterRate", maxJitterRate);
    if (maxAttemptsConfigured) {
        stringHelper.add("maxAttempts", maxAttempts);
    }

    return stringHelper.toString();
}
 
Example 5
Source Project: grpc-java   Source File: RouteMatch.java    License: 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 6
/**
 * Register a URL containing a YANG text.
 *
 * @param url YANG text source URL
 * @return a YangTextSchemaSourceRegistration for this URL
 * @throws YangSyntaxErrorException When the YANG file is syntactically invalid
 * @throws IOException when the URL is not readable
 * @throws SchemaSourceException When parsing encounters general error
 */
public @NonNull YangTextSchemaSourceRegistration registerSource(final @NonNull URL url)
        throws SchemaSourceException, IOException, YangSyntaxErrorException {
    checkArgument(url != null, "Supplied URL must not be null");

    final String path = url.getPath();
    final String fileName = path.substring(path.lastIndexOf('/') + 1);
    final SourceIdentifier guessedId = guessSourceIdentifier(fileName);
    return registerSource(new YangTextSchemaSource(guessedId) {
        @Override
        public InputStream openStream() throws IOException {
            return url.openStream();
        }

        @Override
        protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
            return toStringHelper.add("url", url);
        }
    });
}
 
Example 7
Source Project: armeria   Source File: DefaultCookie.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues()
                                             .add("name", name)
                                             .add("value", !value.isEmpty() ? value : "<EMPTY>")
                                             .add("valueQuoted", valueQuoted)
                                             .add("domain", domain)
                                             .add("path", path);

    if (maxAge != Cookie.UNDEFINED_MAX_AGE) {
        helper.add("maxAge", maxAge);
    }

    if (secure) {
        helper.addValue("secure");
    }

    if (httpOnly) {
        helper.addValue("httpOnly");
    }

    helper.add("sameSite", sameSite);
    return helper.toString();
}
 
Example 8
Source Project: ldp4j   Source File: MutableIndirectContainerTemplate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ToStringHelper stringHelper() {
	return
		super.
			stringHelper().
				add("insertedContentRelation",this.insertedContentRelation);
}
 
Example 9
Source Project: opc-ua-stack   Source File: DataValue.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper helper = MoreObjects.toStringHelper(this);
    helper.add("value", value);
    helper.add("status", status);
    if (sourceTime != null) {
        helper.add("sourceTime", sourceTime);
    }
    if (serverTime != null) {
        helper.add("serverTime", serverTime);
    }

    return helper.toString();
}
 
Example 10
Source Project: kop   Source File: GroupMetadata.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper helper = MoreObjects.toStringHelper("GroupMetadata")
        .add("groupId", groupId)
        .add("generation", generationId)
        .add("protocolType", protocolType)
        .add("state", state)
        .add("members", members);
    return helper.toString();
}
 
Example 11
@Override
public String toString() {
  ToStringHelper tsh = MoreObjects.toStringHelper(getClass());

  tsh.add("id", getId());
  tsh.add("contact", contact);
  tsh.add("street", street);
  tsh.add("area", area);
  tsh.add("city", city);
  tsh.add("zip", zip);
  tsh.add("country", country);

  return tsh.omitNullValues().toString();
}
 
Example 12
Source Project: everrest   Source File: JsonUtils.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private Object invokeToString() {
    Method[] allMethods = anInterface.getMethods();
    ToStringHelper toStringHelper = MoreObjects.toStringHelper(anInterface);
    for (Method method : allMethods) {
        String key;
        if ((key = getKey(method)) != null && method.getParameterTypes().length == 0) {
            toStringHelper.add(key, getValue(key, method));
        }
    }
    return toStringHelper.toString();
}
 
Example 13
Source Project: ldp4j   Source File: ValidationConstraintFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	ToStringHelper stringHelper =
		MoreObjects.
			toStringHelper(constraintName()).
				add("individual",this.individualId==null?"<any>":FormatUtils.formatId(this.individualId)).
				add("predicate", this.predicate);
	List<String> rawValues=Lists.newArrayList();
	for(Value value:values) {
		rawValues.add(FormatUtils.formatValue(value));
	}
	stringHelper.add(constraintInterpretation(),rawValues);
	return stringHelper.toString();
}
 
Example 14
Source Project: centraldogma   Source File: CacheableHistoryCall.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void toString(ToStringHelper helper) {
    helper.add("from", from)
          .add("to", to)
          .add("pathPattern", pathPattern)
          .add("maxCommits", maxCommits);
}
 
Example 15
Source Project: onos   Source File: LinkNameAttributeSubTlv.java    License: 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 16
@Override
public YangTextSchemaSource restoreAsType(final SourceIdentifier sourceIdentifier, final File cachedSource) {
    return new YangTextSchemaSource(sourceIdentifier) {

        @Override
        protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
            return toStringHelper;
        }

        @Override
        public InputStream openStream() throws IOException {
            return Files.newInputStream(cachedSource.toPath());
        }
    };
}
 
Example 17
Source Project: armeria   Source File: Endpoint.java    License: 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 18
Source Project: onos   Source File: IPv6SubObject.java    License: 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 19
Source Project: centraldogma   Source File: ChangeDto.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper stringHelper = MoreObjects.toStringHelper(this)
                                                   .add("path", path())
                                                   .add("type", type());
    if (content() != null) {
        stringHelper.add("content", content());
    }

    return stringHelper.toString();
}
 
Example 20
Source Project: arctic-sea   Source File: AbstractI18NMetadata.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return a {@link ToStringHelper} filled with the state of this class
 */
protected ToStringHelper toStringHelper() {
    return MoreObjects.toStringHelper(this)
            .add("identifier", getIdentifier())
            .add("name", getName())
            .add("description", getDescription());
}
 
Example 21
Source Project: onos   Source File: NexthopIPv6addressTlv.java    License: 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("IpAddress", result);

    return toStrHelper.toString();
}
 
Example 22
Source Project: onos   Source File: IgpRouterIdSubTlv.java    License: 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 23
Source Project: batfish   Source File: If.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
  ToStringHelper h = MoreObjects.toStringHelper(this).add("guard", _guard);
  if (_trueStatements != null && !_trueStatements.isEmpty()) {
    h.add("trueStatements", _trueStatements);
  }
  if (_falseStatements != null && !_falseStatements.isEmpty()) {
    h.add("falseStatements", _falseStatements);
  }
  return h.toString();
}
 
Example 24
Source Project: onos   Source File: IPv6NeighborAddressSubTlv.java    License: 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 25
Source Project: copybara   Source File: PullRequestOrIssue.java    License: Apache License 2.0 5 votes vote down vote up
protected ToStringHelper getToStringHelper() {
  return MoreObjects.toStringHelper(this)
      .add("number", number)
      .add("state", state)
      .add("title", title)
      .add("body", body)
      .add("created_at", createdAt)
      .add("updated_at", updatedAt);
}
 
Example 26
Source Project: yangtools   Source File: YangLocationPath.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public final String toString() {
    final ToStringHelper helper = MoreObjects.toStringHelper(YangLocationPath.class).add("absolute", isAbsolute());
    if (!steps.isEmpty()) {
        helper.add("steps", steps);
    }
    return helper.toString();
}
 
Example 27
Source Project: enmasse   Source File: AuthenticationService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ToStringHelper toStringHelper() {
    return super.toStringHelper()
            .add("name", this.name)
            .add("type", this.type)
            .add("overrides", this.overrides);
}
 
Example 28
Source Project: enmasse   Source File: CommonCondition.java    License: Apache License 2.0 5 votes vote down vote up
protected ToStringHelper toStringHelper() {
    return MoreObjects.toStringHelper(this)
            .add("type", this.type)
            .add("status", this.status)
            .add("lastTransitionTime", this.lastTransitionTime)
            .add("reason", this.reason)
            .add("message", this.message);
}
 
Example 29
Source Project: enmasse   Source File: DeviceCredential.java    License: Apache License 2.0 5 votes vote down vote up
protected ToStringHelper toStringHelper() {
    return MoreObjects.toStringHelper(this)
            .add("authId", this.authId)
            .add("type", this.type)
            .add("enabled", this.enabled)
            .add("secrets", this.secrets);
}
 
Example 30
Source Project: onos   Source File: IsisAreaIdentifierSubTlv.java    License: 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();
}