New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pretty string representations for Range and Requirement #33
Conversation
´java.util.Objects`, which is being used in `Requirement`, has only been available since Java 7.
Instead of a relatively abstract representation for `Range#toString()` and `Requirement#toString()` they now return a representation which is in turn again a valid range or version expression. Example for `Range#toString()`: * Before: "(EQ, 1.2.3)" * After: "=1.2.3" Examples for `Requirement#toString()`: * Before: "Requirement{(EQ, 1.2.3)}" * After: "=1.2.3" * Before: "Requirement{(EQ, 1.2.3) OR (LT, 2.0.0)}" * After: "=1.2.3 || <2.0.0"
Refs #31 (for the correct Java version in the Maven POM) |
This is awesome, thank you very much. One thing though, why upgrade to java 7?I get that the What are your thoughts? |
@vdurmont I didn't add the usage of the This being said, are there any reservations about upgrading to Java 7 (or even Java 8) in this project? |
@vdurmont Any chance to get this merged and a new release of semver4j? I'm currently working around the |
@vdurmont Is there anything I could help you with getting this merged? |
* Update to Java 7 in Maven POM ´java.util.Objects`, which is being used in `Requirement`, has only been available since Java 7. * Add pretty `toString()` representation for Range and Requirement Instead of a relatively abstract representation for `Range#toString()` and `Requirement#toString()` they now return a representation which is in turn again a valid range or version expression. Example for `Range#toString()`: * Before: "(EQ, 1.2.3)" * After: "=1.2.3" Examples for `Requirement#toString()`: * Before: "Requirement{(EQ, 1.2.3)}" * After: "=1.2.3" * Before: "Requirement{(EQ, 1.2.3) OR (LT, 2.0.0)}" * After: "=1.2.3 || <2.0.0"
This PR adds pretty
toString()
representations for theRange
andRequirement
classes.Instead of a relatively abstract representation for
Range#toString()
andRequirement#toString()
, these methods now return a representation which is in turn again a valid range or version expression.Example for
Range#toString()
:Examples for
Requirement#toString()
:Before: "Requirement{(EQ, 1.2.3)}"
After: "=1.2.3"
Before: "Requirement{(EQ, 1.2.3) OR (LT, 2.0.0)}"
After: "=1.2.3 || <2.0.0"