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

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: HumanReadables.java    From android-test with 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 #2
Source File: BackoffSpec.java    From armeria with 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 #3
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 #4
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 #5
Source File: YangTextSchemaContextResolver.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 #6
Source File: AbstractMirror.java    From centraldogma with 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 #7
Source File: DefaultCookie.java    From armeria with 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 File: CacheableHistoryCall.java    From centraldogma with 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 #9
Source File: FilesystemSchemaSourceCache.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@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 #10
Source File: NexthopIPv6addressTlv.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("IpAddress", result);

    return toStrHelper.toString();
}
 
Example #11
Source File: JsonUtils.java    From everrest with 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 #12
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 #13
Source File: LinkNameAttributeSubTlv.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 #14
Source File: IPv6SubObject.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 #15
Source File: ChangeDto.java    From centraldogma with 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 #16
Source File: MutableIndirectContainerTemplate.java    From ldp4j with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ToStringHelper stringHelper() {
	return
		super.
			stringHelper().
				add("insertedContentRelation",this.insertedContentRelation);
}
 
Example #17
Source File: DataValue.java    From opc-ua-stack with 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 #18
Source File: ValidationConstraintFactory.java    From ldp4j with 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 #19
Source File: AbstractI18NMetadata.java    From arctic-sea with 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 #20
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 #21
Source File: If.java    From batfish with 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 #22
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 #23
Source File: PullRequestOrIssue.java    From copybara with 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 #24
Source File: YangLocationPath.java    From yangtools with 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 #25
Source File: AuthenticationService.java    From enmasse with 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 #26
Source File: CommonCondition.java    From enmasse with 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 #27
Source File: DeviceCredential.java    From enmasse with 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 #28
Source File: IsisAreaIdentifierSubTlv.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 #29
Source File: SharedRiskLinkGroupSubTlv.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 (int b : srlgValue) {
        result.append(String.format("%02X ", b));
    }
    toStrHelper.add("Value", result);

    return toStrHelper.toString();
}
 
Example #30
Source File: OpaqueNodePropertiesSubTlv.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();
}