Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
feature: update default ToString
Browse files Browse the repository at this point in the history
  • Loading branch information
iamceph committed Mar 17, 2022
1 parent da8f796 commit 648de1e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
id 'java-library'
id 'idea'
id 'io.freefair.lombok' version '6.3.0'
id 'io.freefair.lombok' version '6.4.1'

id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id "nebula.release" version "16.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.iamceph.resulter.core.api.ResultStatus;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
Expand All @@ -15,7 +14,6 @@
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@ToString(callSuper = true)
@Accessors(fluent = true)
final class DataResultableImpl<T> extends ResultableImpl implements DataResultable<T> {
private final T data;
Expand Down Expand Up @@ -56,4 +54,14 @@ public boolean isFail() {
public boolean isWarning() {
return status == ResultStatus.WARNING;
}

@Override
public String toString() { return "DataResultable {" +
"data=" + (data != null ? data : "empty") +
", status=" + status +
", message='" + (message != null ? message : "empty") + '\'' +
", error=" + (error != null ? error.getMessage() : "empty") +
'}';

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public GroupedResultable merge(Collection<Resultable> resultables) {
public List<String> messages() {
return resultables.stream()
.map(Resultable::message)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}

Expand Down Expand Up @@ -133,4 +132,13 @@ private String toLineMessage() {
public ProtoResultable asProto() {
return convertor().asProto();
}

@Override
public String toString() {
return "GroupedResultable {" +
"status=" + status() +
", message='" + (message().isEmpty() ? message() : "empty") + '\'' +
", error=" + (error() != null ? error() : "empty") +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Default implementation of the {@link Resultable}
*/
@EqualsAndHashCode
@ToString
@Getter
@Accessors(fluent = true)
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
Expand Down Expand Up @@ -64,4 +63,13 @@ public <K> K convert(Class<K> target) {
public ProtoResultable asProto() {
return convertor().asProto();
}

@Override
public String toString() {
return "Resultable {" +
"status=" + status +
", message='" + (message != null ? message : "empty") + '\'' +
", error=" + (error != null ? error.getMessage() : "empty") +
'}';
}
}

0 comments on commit 648de1e

Please sign in to comment.