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

The following examples show how to use com.google.common.base.MoreObjects.ToStringHelper#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: 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 2
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 3
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 4
Source File: ExchangeMatcher.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public String toString()
{
    ToStringHelper string = toStringHelper(this)
            .add("scope", scope)
            .add("type", type)
            .add("orderBy", orderBy)
            .add("partitionedBy", partitionedBy);
    inputs.ifPresent(inputs -> string.add("inputs", inputs));
    return string.toString();
}
 
Example 5
Source File: OpaqueLinkAttributeSubTlv.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 6
Source File: DestinationSet.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper h = toStringHelper(this)
                            .add("Type", typeOfDstSet.getType())
                            .add("DstSw1", dstSw1)
                            .add("Label1", edgeLabel1);
    if (dstSw2 != null) {
        h.add("DstSw2", dstSw2)
         .add("Label2", edgeLabel2);
    }
    return h.toString();
}
 
Example 7
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 8
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 9
Source File: ByteArraySizeHashPrinter.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    ToStringHelper helper = MoreObjects.toStringHelper("byte[]");
    if (bytes != null) {
        helper.add("length", bytes.length)
              .add("hash", Arrays.hashCode(bytes));
    } else {
        helper.addValue(bytes);
    }
    return helper.toString();
}
 
Example 10
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 11
Source File: Variant.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);

    return helper.toString();
}
 
Example 12
Source File: CommitMessageDto.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("summary", summary());
    if (!isNullOrEmpty(detail)) {
        stringHelper.add("detail", detail());
        stringHelper.add("markup", markup());
    }
    return stringHelper.toString();
}
 
Example 13
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 14
Source File: RetryingClientBuilder.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    final ToStringHelper stringHelper = toStringHelper().add("useRetryAfter", useRetryAfter);
    if (needsContentInRule) {
        stringHelper.add("maxContentLength", maxContentLength);
    }
    return stringHelper.toString();
}
 
Example 15
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 16
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 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: LoggingDecoratorBuilder.java    From armeria with Apache License 2.0 4 votes vote down vote up
private static String toString(
        LoggingDecoratorBuilder self,
        @Nullable Logger logger,
        LogLevel requestLogLevel,
        LogLevel successfulResponseLogLevel,
        LogLevel failureResponseLogLevel,
        Function<? super RequestOnlyLog, LogLevel> requestLogLevelMapper,
        Function<? super RequestLog, LogLevel> responseLogLevelMapper,
        boolean isRequestLogLevelMapperSet,
        boolean isResponseLogLevelMapperSet,
        BiFunction<? super RequestContext, ? super HttpHeaders, ?> requestHeadersSanitizer,
        BiFunction<? super RequestContext, ?, ?> requestContentSanitizer,
        BiFunction<? super RequestContext, ? super HttpHeaders, ?> requestTrailersSanitizer,
        BiFunction<? super RequestContext, ? super HttpHeaders, ?> responseHeadersSanitizer,
        BiFunction<? super RequestContext, Object, ?> responseContentSanitizer,
        BiFunction<? super RequestContext, ? super HttpHeaders, ?> responseTrailersSanitizer) {

    final ToStringHelper helper = MoreObjects.toStringHelper(self)
                                             .omitNullValues()
                                             .add("logger", logger);

    if (isRequestLogLevelMapperSet) {
        helper.add("requestLogLevelMapper", requestLogLevelMapper);
    } else {
        helper.add("requestLogLevel", requestLogLevel);
    }
    if (isResponseLogLevelMapperSet) {
        helper.add("responseLogLevelMapper", responseLogLevelMapper);
    } else {
        helper.add("successfulResponseLogLevel", successfulResponseLogLevel);
        helper.add("failureResponseLogLevel", failureResponseLogLevel);
    }

    if (requestHeadersSanitizer != DEFAULT_HEADERS_SANITIZER) {
        helper.add("requestHeadersSanitizer", requestHeadersSanitizer);
    }
    if (requestContentSanitizer != DEFAULT_CONTENT_SANITIZER) {
        helper.add("requestContentSanitizer", requestContentSanitizer);
    }
    if (requestTrailersSanitizer != DEFAULT_HEADERS_SANITIZER) {
        helper.add("requestTrailersSanitizer", requestTrailersSanitizer);
    }

    if (responseHeadersSanitizer != DEFAULT_HEADERS_SANITIZER) {
        helper.add("responseHeadersSanitizer", responseHeadersSanitizer);
    }
    if (responseContentSanitizer != DEFAULT_CONTENT_SANITIZER) {
        helper.add("responseContentSanitizer", responseContentSanitizer);
    }
    if (responseTrailersSanitizer != DEFAULT_HEADERS_SANITIZER) {
        helper.add("responseTrailersSanitizer", responseTrailersSanitizer);
    }
    return helper.toString();
}
 
Example 19
Source File: PersistencyState.java    From ldp4j with Apache License 2.0 4 votes vote down vote up
@Override
public final String toString() {
	ToStringHelper helper=MoreObjects.toStringHelper(getClass());
	toString(helper);
	return helper.toString();
}
 
Example 20
Source File: InMemoryJavaFileManager.java    From Akatsuki with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	final ToStringHelper helper = MoreObjects.toStringHelper(this).add("uri", toUri())
			.add("kind", kind).add("lastModified", lastModified);
	return helper.toString();
}