Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Version comparisons are carried out in the following order of precedence until o
2. `minor` - Higher minor versions are considered greater.
3. `incremental` - Higher incremental versions are considered greater.
5. `snapshot status` - Release versions are considered greater than snapshot versions.
4. `branch` - Versions with a `Branch.DEVELOP` are considered greater, others are compared lexicographically.
4. `branch` - Versions with a `Branch.MAIN` are considered greater, others are compared lexicographically.
6. `qualifiers` - Qualifiers are compared lexicographically (in order). A version with fewer qualifiers is considered greater.
7. `concrete snapshot timestamp` - If both Versions are ConcreteSnapshotVersions their `timestamp`s are compared _lexicographically_ (**not numerically!** The result for the expected format `yyyyMMdd.HHmmss` is the same, but this is not enforced)
8. `concrete snapshot buildnumber` - If both Versions are ConcreteSnapshotVersions the one with the higher `buildnumber` is considered greater.
Expand Down Expand Up @@ -128,7 +128,7 @@ Otherwise it can be configured with `VersionParser.Characteristics` with these v
```java
final VersionParser parser = new VersionParser(

// do not set branches (they default to Branch.DEVELOP)
// do not set branches (they default to Branch.MAIN)
VersionParser.Characteristics.IGNORE_BRANCHES,

// do not set any qualifiers
Expand All @@ -142,12 +142,12 @@ Generally, a `String` to be parsed into a `Version` has to follow the following
`major` may be omitted if not leaving the `String` empty, defaults to zero (`0`)
`minor` and the leading dot (`.`) may be omitted, defaults to zero (`0`)
`incremental` and the leading dot (`.`) may be omitted, defaults to zero (`0`)
`branch` and the leading hyphon (`-`) may be omitted if no `qualifiers` are given, defaults to `Branch.DEVELOP`
`branch` and the leading hyphon (`-`) may be omitted if no `qualifiers` are given, defaults to `Branch.MAIN`
`qualifiers` and the leading hyphon (`-`) may be ommitted

Here are some valid examples:
```java
"1.0.0-develop"
"1.0.0-main"
"1"
".2"
"1.3-some_feature-release_candidate-0"
Expand Down Expand Up @@ -251,13 +251,13 @@ public class Repository {
which then can be used like this to retrieve only the desired versions:

```java
final List<BaseVersion> developReleases = repository.queryVersions(
final List<BaseVersion> mainReleases = repository.queryVersions(
new VersionTypes(
VersionTypes.PublicationStatusType.RELEASES,
VersionTypes.BranchType.DEVELOP));
VersionTypes.BranchType.MAIN));

final List<BaseVersion> developSnapshots = repository.queryVersions(
VersionTypes.ONLY_DEVELOP_SNAPSHOTS);
final List<BaseVersion> mainSnapshots = repository.queryVersions(
VersionTypes.ONLY_MAIN_SNAPSHOTS);

final List<BaseVersion> all = repository.queryVersions(VersionTypes.ALL);

Expand Down
72 changes: 49 additions & 23 deletions src/main/java/com/sitepark/versioning/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,56 @@
import java.io.ObjectStreamException;
import java.io.Serializable;

/**
* Class, that aims to represent "feature-branches" found in
* {@link Version}s.
* By default a {@code Version} does not explicitly define a {@code Branch}
* (for example {@code "1.0.3"}), in which cases the "non-feature-branch"
* {@link #DEVELOP} is used.
* {@link #MAIN} is used.
*
* <p>
* Branches are compared alphabetically, although for "non-feature-branches"
* the following rules apply:
* <ul>
* <li>{@code non-feature-branch > feature-branch}</li>
* <li>{@code non-feature-branch == non-feature-branch}</li>
* </ul>
*/

Check warning on line 21 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public final class Branch implements Comparable<Branch>, Serializable {
private static final long serialVersionUID = 7052868613896268596L;

private static final String MAIN_VALUE = "main";

Check warning on line 25 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
private static final String DEVELOP_VALUE = "develop";

Check warning on line 26 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

/**
* Denotes the absense of a "feature-branch".
*/
public static final Branch DEVELOP = new Branch(Branch.DEVELOP_VALUE);
public static final Branch MAIN = new Branch(Branch.MAIN_VALUE);

Check notice on line 31 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type

/**
* Denotes the absense of a "feature-branch".
*
* @deprecated use {@link #MAIN} instead
*/
@Deprecated(since = "3.1.0", forRemoval = true)
public static final Branch DEVELOP = Branch.MAIN;

Check notice on line 39 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN' is already in scope because it is declared in an enclosing type

private final String value;

Check warning on line 41 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

/**
* Class Constructor specifiying a String representation of the Branch.
*
* If an empty String is given or
* {@code value.equalsIgnoreCase("develop") == true} the Branch will be
* {@code value.equalsIgnoreCase("main") == true} (and for legacy reasons also
* {@code value.equalsIgnoreCase("develop") == true}) the Branch will be
* considered a "non-feature-branch". In this case one may want to use the
* {@link #DEVELOP} constant instead.
* {@link #MAIN} constant instead.
*
* @param value a String representation of a Branch
* @throws IllegalArgumentException when the value contains spaces or
* hyphens
* @throws NullPointerException when value is <em>null</em>
*/

Check warning on line 56 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public Branch(final String value) {
if (value.indexOf(' ') != -1) {
throw new IllegalArgumentException("Branches cannot contain spaces");
Expand All @@ -51,30 +61,39 @@
if (value.indexOf('-') != -1) {
throw new IllegalArgumentException("Branches cannot contain hyphens");
}
this.value =
value.equalsIgnoreCase(Branch.DEVELOP_VALUE) || value.length() == 0
? Branch.DEVELOP_VALUE
: value;
this.value = this.valueIsMain(value) ? Branch.MAIN_VALUE : value;

Check notice on line 64 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type
}

/**
* Returns wether the Branch is considered a "non-feature-branch".
*
* @return {@code true} if the Branch is equal to {@link #DEVELOP},
* {@code false} otherwise
* @return {@code true} if the Branch is equal to
* {@link #DEVELOP}/{@link #MAIN}, {@code false} otherwise
* @deprecated use {@link #isMain()} instead
*/
@Deprecated(since = "3.1.0", forRemoval = true)
public boolean isDevelop() {
return this.value == Branch.DEVELOP_VALUE;
return this.value == Branch.MAIN_VALUE;

Check warning on line 76 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Error Prone UseEqualsToCompareStrings

Use equals() to compare strings instead of '==' or '!='

Check notice on line 76 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type
}

/**
* Returns wether the Branch is considered a "non-feature-branch".
*
* @return {@code true} if the Branch is equal to
* {@link #DEVELOP}/{@link #MAIN}, {@code false} otherwise
*/
public boolean isMain() {
return this.value == Branch.MAIN_VALUE;

Check warning on line 86 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Error Prone UseEqualsToCompareStrings

Use equals() to compare strings instead of '==' or '!='

Check notice on line 86 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type
}

/**
* Returns wether the Branch is considered a "feature-branch" or not.
*
* @return {@code true} if the Branch is not equal to {@link #DEVELOP},
* {@code false} otherwise
* @return {@code true} if the Branch is not equal to
* {@link #DEVELOP}/{@link #MAIN}, {@code false} otherwise
*/
public boolean isFeature() {
return this.value != Branch.DEVELOP_VALUE;
return this.value != Branch.MAIN_VALUE;

Check warning on line 96 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Error Prone UseEqualsToCompareStrings

Use equals() to compare strings instead of '==' or '!='

Check notice on line 96 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type
}

@Override
Expand All @@ -84,14 +103,14 @@

@Override
public int compareTo(final Branch other) {
switch ((this.isDevelop() ? 1 : 0) + (other.isDevelop() ? 2 : 0)) {
case 1: // only this is develop
switch ((this.isMain() ? 1 : 0) + (other.isMain() ? 2 : 0)) {
case 1: // only this is main
return 1;
case 2: // only other is develop
case 2: // only other is main
return -1;
case 3: // both are develop
case 3: // both are main
return 0;
default: // neither is develop
default: // neither is main
return this.value.compareTo(other.value);
}
}
Expand All @@ -108,13 +127,20 @@

/**
* Assures that the Serializable interface does not create a new instance
* of {@code Branch.DEVELOP_VALUE}, which would mess up comparisons in
* {@code isDevelop} and {@code isFeature}.
* of {@link #MAIN_VALUE}/{@link #DEVELOP_VALUE}, which would mess up
* comparisons in {@link #isMain()}/{@link #isDevelop()} and
* {@link #isFeature()}.
*/
private Object readResolve() throws ObjectStreamException {
if (this.value.equalsIgnoreCase(Branch.DEVELOP_VALUE) || value.length() == 0) {
return Branch.DEVELOP;
if (this.valueIsMain(this.value)) {
return Branch.MAIN;

Check warning on line 136 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style OnlyOneReturn

A method should have only one exit point, and that should be the last statement in the method

Check notice on line 136 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN' is already in scope because it is declared in an enclosing type
}
return this;
}

private boolean valueIsMain(String value) {

Check warning on line 141 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style MethodArgumentCouldBeFinal

Parameter 'value' is not assigned and could be declared final
return value.length() == 0
|| value.equalsIgnoreCase(Branch.DEVELOP_VALUE)

Check warning on line 143 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Best Practices LiteralsFirstInComparisons

Position literals first in String comparisons

Check notice on line 143 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'DEVELOP_VALUE' is already in scope because it is declared in an enclosing type
|| value.equalsIgnoreCase(Branch.MAIN_VALUE);

Check warning on line 144 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Best Practices LiteralsFirstInComparisons

Position literals first in String comparisons

Check notice on line 144 in src/main/java/com/sitepark/versioning/Branch.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryFullyQualifiedName

Unnecessary qualifier 'Branch': 'MAIN_VALUE' is already in scope because it is declared in an enclosing type
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/sitepark/versioning/version/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import com.sitepark.versioning.Branch;
import java.util.List;

/**
* A representation of a generic Version.
* This includes the definition of the most basic fields (named after
* <a href="https://semver.org/">semvers</a> and
* <a href="https://maven.apache.org/">mavens</a> terminology):
* <ul>
* <li>{@code major}</li>
* <li>{@code minor}</li>
* <li>{@code incremental}</li>
* <li>{@code branch}</li>
* <li>{@code qualifiers}</li>
* </ul>
* A instance may be described in the commonly used String format of the
* {@link VersionParser} like so:<br>
* {@code <major>.<minor>.<incremental>-<branch>-<qualifiers>}
*/

Check warning on line 21 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public sealed interface Version extends Comparable<Version>
permits AbstractVersion, BaseVersion, ConcreteVersion {

Expand All @@ -28,7 +28,7 @@
*
* @return the major version
*/
public int getMajor();

Check warning on line 31 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'getMajor': the method is declared in an interface type

/**
* Returns the {@code minor} version.
Expand All @@ -36,7 +36,7 @@
*
* @return the minor version
*/
public int getMinor();

Check warning on line 39 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'getMinor': the method is declared in an interface type

/**
* Returns the {@code incremental} version.
Expand All @@ -44,16 +44,16 @@
*
* @return the incremental version
*/
public int getIncremental();

Check warning on line 47 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'getIncremental': the method is declared in an interface type

/**
* Returns the {@link Branch} of this Version.
* This is never {@code null}; The absence of a feature branch is denoted
* by the {@link Branch#DEVELOP} instance.
* by the {@link Branch#MAIN} instance.
*
* @return the branch
*/
public Branch getBranch();

Check warning on line 56 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'getBranch': the method is declared in an interface type

/**
* Returns all {@code qualifiers} of this Version.
Expand All @@ -62,76 +62,76 @@
*
* @return the branch
*/
public List<String> getQualifiers();

Check warning on line 65 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'getQualifiers': the method is declared in an interface type

/**
* Returns wether this Version is considered a {@code snapshot}.
* Depending on the implementing class this may be determined by varying
* factors.
*
* <p>
* A Version is strictly classifiable into either a {@code snapshot} or a
* {@code release}. Meaning that a instance that returns {@code false} is
* always a {@code release}.
*
* @return {@code true} if this Version is considered a {@code snapshot},
* {@code false} otherwise
* @see #isRelease()
*/

Check warning on line 80 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public abstract boolean isSnapshot();

Check warning on line 81 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifiers 'public abstract' on method 'isSnapshot': the method is declared in an interface type

/**
* Returns wether this Version is considered a {@code release}.
* Depending on the implementing class this may be determined by varying
* factors.
*
* <p>
* A Version is strictly classifiable into either a {@code snapshot} or a
* {@code release}. Meaning that a instance that returns {@code false} is
* always a {@code snapshot}.
*
* @return {@code true} if this Version is considered a {@code release},
* {@code false} otherwise
* @see #isSnapshot()
*/

Check warning on line 96 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public abstract boolean isRelease();

Check warning on line 97 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifiers 'public abstract' on method 'isRelease': the method is declared in an interface type

/**
* Compares this Version to another Version.
* The comparison is carried out in the following order of precedence until
* a field is not considered equal:
* <ol>
* <li>{@code major} - Higher major versions are considered greater.</li>
* <li>{@code minor} - Higher minor versions are considered greater.</li>
* <li>
* {@code incremental} - Higher incremental versions are considered
* greater.
* </li>
* <li>
* {@code snapshot status} - Release versions are considered greater
* than snapshot versions.
* </li>
* <li>
* {@code branch} - {@link Branch}es are compared as described by
* {@link Branch#compareTo}.
* </li>
* <li>
* {@code qualifiers} - Qualifiers are compared lexicographically (in
* order). A version with fewer qualifiers is considered
* greater.
* </li>
* </ol>
*
* @param that the version to be compared
* @return a negative {@code int}, zero ({@code 0}), or a positive
* {@code int} as this Version is less than, equal to, or greater
* than the specified Version.
* @see ReleaseVersion#compareTo(Version)
* @see SnapshotVersion#compareTo(Version)
* @see ConcreteSnapshotVersion#compareTo(Version)
*/

Check warning on line 132 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
@Override
public default int compareTo(final Version that) {

Check warning on line 134 in src/main/java/com/sitepark/versioning/version/Version.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'public' on method 'compareTo': the method is declared in an interface type
return VersionComparator.NATUAL.compare(this, that);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

/**
* A builder class to instantiate {@link ReleaseVersion}s,
* {@link SnapshotVersion}s and {@link ConcreteSnapshotVersion}s.
* {@code ConcreteSnapshotVersion}s require an additional {@code timestamp} and
* {@code buildnumber}.
* All fields have default values.
*
* Usage:
* <pre>new VersionBuilder()
* .setMinor(1)
* .buildRelease()</pre>
*
* <pre>new VersionBuilder()
* .setMajor(3)
* .setIncremental(1)
* .addQualifier("hotfix")
* .buildSnapshot();</pre>
*
* <pre>new VersionBuilder()
* .setMajor(1)
* .setBranch(new Branch("new_core_engine"))
* .buildConcreteSnapshot(
* DateTimeFormatter.ofPattern("yyyyMMdd.HHmmss")
* .format(LocalDate.now())
* this.buildnumber++);</pre>
*/

Check warning on line 35 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public class VersionBuilder {
private AtomicInteger major;

Check warning on line 37 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Design ImmutableField

Field 'major' may be declared final

Check warning on line 37 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
private AtomicInteger minor;

Check warning on line 38 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Design ImmutableField

Field 'minor' may be declared final

Check warning on line 38 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
private AtomicInteger incremental;

Check warning on line 39 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Design ImmutableField

Field 'incremental' may be declared final

Check warning on line 39 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
private Branch branch;

Check warning on line 40 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
private final List<String> qualifiers;

Check warning on line 41 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

/**
* Class Constructor
Expand All @@ -47,19 +47,19 @@
this.major = new AtomicInteger(0);
this.minor = new AtomicInteger(0);
this.incremental = new AtomicInteger(0);
this.branch = Branch.DEVELOP;
this.branch = Branch.MAIN;
this.qualifiers = Collections.synchronizedList(new LinkedList<>());
}

/**
* Specifies a {@code major} to set on {@link Version}s created by this
* instance.
* Otherwise defaults to zero ({@code 0}).
*
* @param major the major version
* @return this instance
* @see Version#getMajor()
*/

Check warning on line 62 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder setMajor(final int major) {
this.major.set(major);
return this;
Expand All @@ -76,15 +76,15 @@
return this.major.get();
}

/**
* Specifies a {@code minor} to set on {@link Version}s created by this
* instance.
* Otherwise defaults to zero ({@code 0}).
*
* @param minor the minor version
* @return this instance
* @see Version#getMinor()
*/

Check warning on line 87 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder setMinor(final int minor) {
this.minor.set(minor);
return this;
Expand All @@ -101,15 +101,15 @@
return this.minor.get();
}

/**
* Specifies a {@code incremental} to set on {@link Version}s created by
* this instance.
* Otherwise defaults to zero ({@code 0}).
*
* @param incremental the incremental version
* @return this instance
* @see Version#getIncremental()
*/

Check warning on line 112 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder setIncremental(final int incremental) {
this.incremental.set(incremental);
return this;
Expand All @@ -126,15 +126,15 @@
return this.incremental.get();
}

/**
* Specifies a {@link Branch} to set on {@link Version}s created by this
* instance.
* Otherwise defaults to {@link Branch#DEVELOP}.
* Otherwise defaults to {@link Branch#MAIN}.
*
* @param branch the branch to set
* @return this instance
* @see Version#getBranch()
*/

Check warning on line 137 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder setBranch(final Branch branch) {
this.branch = Objects.requireNonNull(branch);
return this;
Expand All @@ -142,7 +142,7 @@

/**
* Returns the currently set {@link Branch}.
* Defaults to {@link Branch#DEVELOP}.
* Defaults to {@link Branch#MAIN}.
*
* @return the incremental version
* @see Version#getBranch()
Expand All @@ -151,16 +151,16 @@
return this.branch;
}

/**
* Specifies and overwrites all {@code qualifiers} to set on
* {@link Version}s created by this instance.
*
* @param qualifiers a {@code List} of qualifiers to set
* @return this instance
* @throws NullPointerException if {@code qualifiers} contains {@code null}
* @see #addQualifier(String)
* @see Version#getQualifiers()
*/

Check warning on line 163 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder setQualifiers(final List<String> qualifiers) {
this.qualifiers.clear();
for (final String qualifier : qualifiers) {
Expand All @@ -169,16 +169,16 @@
return this;
}

/**
* Appends a {@code qualifier} to the {@code qualifiers} to set on
* {@link Version}s created by this instance.
*
* @param qualifier the qualifier to append
* @return this instance
* @throws NullPointerException if {@code qualifier} is {@code null}
* @see #setQualifiers(List)
* @see Version#getQualifiers()
*/

Check warning on line 181 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public VersionBuilder addQualifier(final String qualifier) {
this.qualifiers.add(Objects.requireNonNull(qualifier));
return this;
Expand All @@ -196,45 +196,45 @@
return Collections.unmodifiableList(this.qualifiers);
}

/**
* Builds a {@link ReleaseVersion} with all set fields.
* For Fields that were not explicitly specified their default values are
* applied.
*
* @return a new ReleaseVersion
* @see #buildSnapshot()
* @see #buildConcreteSnapshot(String, int)
*/

Check warning on line 207 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public ReleaseVersion buildRelease() {
return new ReleaseVersion(this);
}

/**
* Builds a {@link SnapshotVersion} with all set fields.
* For Fields that were not explicitly specified their default values are
* applied.
*
* @return a new SnapshotVersion
* @see #buildRelease()
* @see #buildConcreteSnapshot(String, int)
*/

Check warning on line 220 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public SnapshotVersion buildSnapshot() {
final SnapshotVersion value = new SnapshotVersion(this);

Check warning on line 222 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style VariableCanBeInlined

Consider simply using the value vs. storing it in local variable 'value'.
return value;
}

/**
* Builds a {@link ConcreteSnapshotVersion} with all set fields.
* This requires the {@code timestamp} and {@code buildnumber} fields to be
* specified. Other Fields that were not explicitly specified have their
* default values applied.
*
* @param timestamp the timestamp to set
* @param buildnumber the buildnumber to set
* @return a new ConcreteSnapshotVersion
* @see #buildRelease()
* @see #buildSnapshot()
*/

Check warning on line 237 in src/main/java/com/sitepark/versioning/version/VersionBuilder.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public ConcreteSnapshotVersion buildConcreteSnapshot(
final String timestamp, final int buildnumber) {
return new ConcreteSnapshotVersion(this, timestamp, buildnumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @param <R> class of the {@code Version} the implementation attempts to parse
*/
abstract class VersionParseExecutor<R> {

Check warning on line 14 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Design TooManyMethods

This class has too many methods, consider refactoring it.

/**
* The section of a {@link Version}-String this parser may be in.
Expand All @@ -24,20 +24,20 @@
QUALIFIER;
}

protected final String string;

Check warning on line 27 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected final int maxIndex;

Check warning on line 28 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected final byte flags;

Check warning on line 29 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

protected char currentChar;

Check warning on line 31 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected int index = -1;

Check warning on line 32 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected boolean isLastChar = false;

Check warning on line 33 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Performance RedundantFieldInitializer

Avoid using redundant field initializer for 'isLastChar'

Check warning on line 33 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected StringBuilder currentItem = new StringBuilder();

Check warning on line 34 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Best Practices AvoidStringBufferField

StringBuffers can grow quite a lot, and so may become a source of memory leak (if the owning class has a long life time).

Check warning on line 34 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected int currentItemLength = 0;

Check warning on line 35 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Performance RedundantFieldInitializer

Avoid using redundant field initializer for 'currentItemLength'

Check warning on line 35 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required
protected Section currentSection = Section.MAJOR;

Check warning on line 36 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

protected final VersionBuilder versionBuilder;

Check warning on line 38 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

VersionParseExecutor(final String string, final byte flags) {

Check warning on line 40 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style CommentDefaultAccessModifier

Missing commented default access modifier on constructor 'VersionParseExecutor(String, byte)'
this.string = string;
this.maxIndex = string.length() - 1;
this.flags = flags;
Expand All @@ -50,12 +50,12 @@
* @throws ParseException if the String is not compliant with the required
* format
*/
public R execute() throws ParseException {

Check warning on line 53 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Design PublicMemberInNonPublicType

Public member 'execute' declared in a non-public type
if (this.maxIndex == -1) {
this.fail();
}
do {
this.isLastChar = ++this.index == this.maxIndex;

Check warning on line 58 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Error Prone AssignmentInOperand

Avoid assignments in operands
this.currentChar = this.string.charAt(this.index);
this.step();
} while (!this.isLastChar);
Expand All @@ -65,7 +65,7 @@
/**
* Consumes a single char
*/
private void step() throws ParseException {

Check warning on line 68 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Design CyclomaticComplexity

The method 'step()' has a cyclomatic complexity of 15.
switch (this.currentChar) {
case ' ':
case '\n':
Expand Down Expand Up @@ -199,15 +199,16 @@
/**
* Adds the {@link #currentItem} as {@code branch} to the
* {@link #versionBuilder} and advances to the {@link Section#QUALIFIER}.
* Defaults to {@link Branch#DEVELOP} if the
* Defaults to {@link Branch#MAIN} if the
* {@link VersionParser.Characteristics#IGNORE_BRANCHES} flag is set.
*
* @see VersionBuilder#setBranch(Branch)
*/
protected void addBranch() {
final String branch = this.currentItem.toString();
if (!VersionParser.Characteristics.IGNORE_BRANCHES.isSet(this.flags)
&& !branch.equalsIgnoreCase("main")

Check warning on line 210 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Best Practices LiteralsFirstInComparisons

Position literals first in String comparisons
&& !branch.equalsIgnoreCase("develop")) {

Check warning on line 211 in src/main/java/com/sitepark/versioning/version/VersionParseExecutor.java

View workflow job for this annotation

GitHub Actions / PMD

Best Practices LiteralsFirstInComparisons

Position literals first in String comparisons
this.versionBuilder.setBranch(new Branch(branch));
}
this.resetCurrentItem();
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/com/sitepark/versioning/version/VersionParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,87 @@
import com.sitepark.versioning.Branch;
import java.text.ParseException;

/**
* A class to parse Strings of a certain format into {@link Version}s.
* Generally this format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>"}
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty, defaults
* to zero ({@code 0})
* </li>
* <li>
* {@code minor} and the leading dot ({@code .}) may be omitted, defaults
* to zero ({@code 0})
* </li>
* <li>
* {@code incremental} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if no
* {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
* </li>
* </ul>
*
* <p>
* Therefore all of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
* "-experimental"
* </pre>
*
* <p>
* When parsing {@link PotentialSnapshotVersion}s the {@code qualifier}
* {@code "SNAPSHOT"} denotes the {@code Version} to be a {@link
* SnapshotVersion} if at the end of the String.
* <pre>
* // SnapshotVersion
* parser.parsePotentialSnapshot("1.0-FEATURE-SNAPSHOT");
* // ReleaseVersion
* parser.parsePotentialSnapshot("1.0-SNAPSHOT-FEATURE");
* </pre>
*
* <p>
* For {@link PotentialConcreteSnapshotVersion}s these are instead a timestamp
* of the form {@code yyyyMMdd.HHmmss} and a buildnumber.
* <pre>
* // ConcreteSnapshotVersion
* parser.parsePotentialConcreteSnapshot("1.0-20230605.123612-1);
* // ReleaseVersion
* parser.parsePotentialConcreteSnapshot("1.0-1-20230605.123612);
* </pre>
*
* <p>
* A VersionParser instance may be configured by specifiying one or more
* {@link Characteristics} in the constructor.
* <ul>
* <li>
* {@link Characteristics#IGNORE_BRANCHES}<br>
* Always set the {@link Branch} to {@link Branch#DEVELOP}. This does not
* Always set the {@link Branch} to {@link Branch#MAIN}. This does not
* cause {@code branch} keywords to be added to the {@code qualifiers}.
* </li>
* <li>
* {@link Characteristics#IGNORE_QUALIFIERS}<br>
* Do not set any {@code qualifiers}. Does not influence the {@code branch}
* or the exclusive {@code qualifiers} for {@link SnapshotVersion}s
* ({@code "SNAPSHOT"}) or {@link ConcreteSnapshotVersion}s
* ({@code timestamp} and {@code buildnumber}). </li>
* </ul>
*
* <p>
* This class is immutable and thread-safe.
*
* @see #parseRelease(String)
* @see #parseBaseVersion(String)
* @see #parseConcreteVersion(String)
*/

Check warning on line 86 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public class VersionParser {

/**
Expand All @@ -91,14 +91,14 @@
*/
public static final VersionParser DEFAULT_PARSER = new VersionParser();

private final byte flags;

Check warning on line 94 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

/**
* Options to configure a {@link VersionParser} instance with.
*/
public enum Characteristics {
/**
* Always set the {@link Branch} to {@link Branch#DEVELOP}.
* Always set the {@link Branch} to {@link Branch#MAIN}.
* This does not cause {@code branch} keywords to be added to the
* {@code qualifiers}.
*/
Expand All @@ -112,17 +112,17 @@
*/
IGNORE_QUALIFIERS((byte) 0b0000_0010);

private final byte mask;

Check warning on line 115 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentRequired

Field comments are required

private Characteristics(final byte mask) {

Check warning on line 117 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style UnnecessaryModifier

Unnecessary modifier 'private' on constructor 'Characteristics(byte)': enum constructors are implicitly private
this.mask = mask;
}

int getMask() {

Check warning on line 121 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style CommentDefaultAccessModifier

Missing commented default access modifier on method 'getMask()'
return this.mask;
}

boolean isSet(final byte value) {

Check warning on line 125 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Code Style CommentDefaultAccessModifier

Missing commented default access modifier on method 'isSet(byte)'
return (value & this.mask) == this.mask;
}
}
Expand All @@ -141,116 +141,116 @@
this.flags = flags;
}

/**
* Parses a String into a {@link ReleaseVersion}.
*
* The required format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>"}
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code minor} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code incremental} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if
* no {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* no {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
* </li>
* </ul>
*
* <p>
* All of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
* "-experimental"
* </pre>
*
* <p>
* {@code qualifiers}, that imply the {@link Version} not beeing a
* {@link ReleaseVersion} in the {@link #parseBaseVersion(String)} and
* {@link #parseConcreteVersion(String)} methods do not have any special
* meaning here.
*
* @param version the String to be parsed
* @return the resulting {@link ReleaseVersion}
* @throws ParseException when the given String is not compatible with the
* required format
* @see #parseBaseVersion(String)
* @see #parseConcreteVersion(String)
*/

Check warning on line 193 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public ReleaseVersion parseRelease(final String version) throws ParseException {
return new ReleaseParseExecutor(version, this.flags).execute();
}

/**
* Parses a String into either a {@link SnapshotVersion} or a
* {@link ReleaseVersion}.
*
* The required format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>-SNAPSHOT"}
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code minor} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code incremental} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if
* no {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* no {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
* </li>
* <li>
* {@code "-SNAPSHOT"} causes the result to be a {@code SnapshotVersion}
* if present and a {@code ReleaseVersion} otherwise
* </li>
* </ul>
*
* <p>
* All of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
* "-experimental"
* </pre>
*
* <p>
* If the {@code "SNAPSHOT"} {@code qualifier} is not located at the very
* end it is interpreted as any other {@code qualifier} or as
* {@code branch} depending on it's position.
*
* @param version the String to be parsed
* @return the resulting {@link Version} wrapped inside a
* {@link PotentialSnapshotVersion}
* @throws ParseException when the given String is not compatible with the
* required format
* @deprecated use {@link #parseBaseVersion(String)} instead
* @see #parseRelease(String)
* @see #parsePotentialConcreteSnapshot(String)
*/

Check warning on line 253 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
@SuppressWarnings("removal")
@Deprecated(since = "3.0.0", forRemoval = true)
public PotentialSnapshotVersion parsePotentialSnapshot(final String version)
Expand All @@ -259,70 +259,70 @@
new BaseVersionParseExecutor(version, this.flags).execute());
}

/**
* Parses a String into either a {@link SnapshotVersion} or a
* {@link ReleaseVersion}.
*
* The required format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>-SNAPSHOT"}
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code minor} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code incremental} and the leading dot ({@code .}) may be omitted,
* defaults to zero ({@code 0})
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if
* no {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* no {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
* </li>
* <li>
* {@code "-SNAPSHOT"} causes the result to be a {@code SnapshotVersion}
* if present and a {@code ReleaseVersion} otherwise
* </li>
* </ul>
*
* <p>
* All of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
* "-experimental"
* </pre>
*
* <p>
* If the {@code "SNAPSHOT"} {@code qualifier} is not located at the very
* end it is interpreted as any other {@code qualifier} or as
* {@code branch} depending on it's position.
*
* @param version the String to be parsed
* @return the resulting {@link BaseVersion}
* @throws ParseException when the given String is not compatible with the
* required format
* @see #parseRelease(String)
* @see #parseConcreteVersion(String)
*/

Check warning on line 315 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Too many lines
public BaseVersion parseBaseVersion(final String version) throws ParseException {
return new BaseVersionParseExecutor(version, this.flags).execute();
}

/**
* Parses a String into either a {@link ConcreteSnapshotVersion} or a
* {@link ReleaseVersion}.
*
* The required format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>-<timestamp>-<buildnumber>"}

Check warning on line 325 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Line too long
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty,
Expand All @@ -338,7 +338,7 @@
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if
* no {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* no {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
Expand All @@ -353,7 +353,7 @@
* <p>
* All of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
Expand Down Expand Up @@ -383,12 +383,12 @@
new ConcreteVersionParseExecutor(version, this.flags).execute());
}

/**
* Parses a String into either a {@link ConcreteSnapshotVersion} or a
* {@link ReleaseVersion}.
*
* The required format is as follows:<br>
* {@code "<major>.<minor>.<incremental>-<branch>-<qualifiers>-<timestamp>-<buildnumber>"}

Check warning on line 391 in src/main/java/com/sitepark/versioning/version/VersionParser.java

View workflow job for this annotation

GitHub Actions / PMD

Documentation CommentSize

Comment is too large: Line too long
* <ul>
* <li>
* {@code major} may be omitted if not leaving the String empty,
Expand All @@ -404,7 +404,7 @@
* </li>
* <li>
* {@code branch} and the leading hyphon ({@code -}) may be omitted if
* no {@code qualifiers} are given, defaults to {@link Branch#DEVELOP}
* no {@code qualifiers} are given, defaults to {@link Branch#MAIN}
* </li>
* <li>
* {@code qualifiers} and the leading hyphon ({@code -}) may be ommitted
Expand All @@ -419,7 +419,7 @@
* <p>
* All of these are valid examples:
* <pre>
* "1.0.0-develop"
* "1.0.0-main"
* "1"
* ".2"
* "1.3-some_feature-release_candidate-0"
Expand Down
Loading
Loading