Skip to content

Commit

Permalink
feat: add toString methods on some resolver classes
Browse files Browse the repository at this point in the history
helps for debugging.
  • Loading branch information
keturn committed Apr 20, 2021
1 parent a51ba07 commit 84b5db3
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 @@ -391,6 +392,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 @@ -439,6 +450,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 84b5db3

Please sign in to comment.