Skip to content

Commit

Permalink
Merge pull request #99 from MovingBlocks/v7/feat/resolveToString
Browse files Browse the repository at this point in the history
feat: add toString methods on some resolver classes
  • Loading branch information
skaldarnar authored Apr 23, 2021
2 parents bd593ed + 84b5db3 commit d97b8f7
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package org.terasology.gestalt.module.dependencyresolution;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -378,6 +379,16 @@ public boolean isCompatible(PossibleVersion version) {
return missingAllowed;
}
}

@Override
public String toString() {
MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this)
.addValue(versionRange);
if (missingAllowed) {
s.addValue("missingAllowed");
}
return s.toString();
}
}

private static class PossibleVersion implements Comparable<PossibleVersion> {
Expand Down Expand Up @@ -426,6 +437,13 @@ public boolean equals(Object obj) {
public int hashCode() {
return Objects.hash(version);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.addValue(version.map(Object::toString).orElse("empty"))
.toString();
}
}

}

0 comments on commit d97b8f7

Please sign in to comment.