From 6205954e7b0c429149e50a851a11c25d75df3da6 Mon Sep 17 00:00:00 2001 From: Qingtian Wang Date: Fri, 9 Aug 2024 01:15:13 -0500 Subject: [PATCH] + better names --- pom.xml | 4 ++-- .../plugins/semver/SemverNormalVersion.java | 20 +++++++++---------- .../mojos/CalendarVersionFormatter.java | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index d996084..a27d250 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ io.github.q3769 semver-maven-plugin - 20240116.0.202408090559 + 20240116.0.202408090614 maven-plugin semver-maven-plugin @@ -229,7 +229,7 @@ io.github.q3769 semver-maven-plugin - 20240116.0.202408090559 + 20240116.0.202408090614 org.apache.maven.plugins diff --git a/src/main/java/q3769/maven/plugins/semver/SemverNormalVersion.java b/src/main/java/q3769/maven/plugins/semver/SemverNormalVersion.java index 4aec402..52cac3d 100644 --- a/src/main/java/q3769/maven/plugins/semver/SemverNormalVersion.java +++ b/src/main/java/q3769/maven/plugins/semver/SemverNormalVersion.java @@ -38,7 +38,7 @@ */ public enum SemverNormalVersion { - /** Major version category. */ + /** Major version */ MAJOR { /** * Gets the major version number from the given semantic version. @@ -47,7 +47,7 @@ public enum SemverNormalVersion { * @return the major version number */ @Override - public long getNormalVersionNumber(Version semver) { + public long getNumber(Version semver) { return semver.majorVersion(); } @@ -69,7 +69,7 @@ public Version incrementTo(long target, Version semver) { } }, - /** Minor version category. */ + /** Minor version */ MINOR { /** * Gets the minor version number from the given semantic version. @@ -78,7 +78,7 @@ public Version incrementTo(long target, Version semver) { * @return the minor version number */ @Override - public long getNormalVersionNumber(Version semver) { + public long getNumber(Version semver) { return semver.minorVersion(); } @@ -100,7 +100,7 @@ public Version incrementTo(long target, Version semver) { } }, - /** Patch version category. */ + /** Patch version */ PATCH { /** * Gets the patch version number from the given semantic version. @@ -109,7 +109,7 @@ public Version incrementTo(long target, Version semver) { * @return the patch version number */ @Override - public long getNormalVersionNumber(Version semver) { + public long getNumber(Version semver) { return semver.patchVersion(); } @@ -176,14 +176,14 @@ private static IllegalArgumentException incrementError( * @param semver the semantic version * @return the version number of the corresponding category */ - public abstract long getNormalVersionNumber(Version semver); + public abstract long getNumber(Version semver); /** * Increments the version number of the corresponding category to the specified target value. * - * @param target the target version number - * @param semver the original semantic version - * @return the new semantic version with the version number incremented + * @param target the target number to increment this normal version number to + * @param semver the original semantic version to increment + * @return the new semantic version with the normal version number incremented */ public abstract Version incrementTo(long target, Version semver); } diff --git a/src/main/java/q3769/maven/plugins/semver/mojos/CalendarVersionFormatter.java b/src/main/java/q3769/maven/plugins/semver/mojos/CalendarVersionFormatter.java index cb6c3b2..b4dfbe2 100644 --- a/src/main/java/q3769/maven/plugins/semver/mojos/CalendarVersionFormatter.java +++ b/src/main/java/q3769/maven/plugins/semver/mojos/CalendarVersionFormatter.java @@ -59,7 +59,7 @@ enum CalendarVersionFormatter { public static Version calendarIncrement( Version original, @Nonnull SemverNormalVersion selectedNormalVersion) throws MojoFailureException { - long selectedNormalVersionNumber = selectedNormalVersion.getNormalVersionNumber(original); + long selectedNormalVersionNumber = selectedNormalVersion.getNumber(original); Instant now = Instant.now(); for (CalendarVersionFormatter formatter : values()) { long updatedNormalVersionNumber = formatter.format(now);