Skip to content

Commit

Permalink
Optimize the issue of default version for BuildVersion Constructor . (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
misselvexu committed Jul 1, 2022
1 parent 05e7b30 commit ab05b73
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@

import javax.annotation.Nullable;

import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

@lombok.Data
public final class BuildVersion implements Serializable, Comparable<BuildVersion> {

private static final String DEFAULT_VERSION = "UNKNOWN";

private final String value;

private BuildVersion(String value) {
Assert.hasText(value, "'value' must not be empty");
this.value = value;
if(!StringUtils.hasText(value)) {
this.value = DEFAULT_VERSION;
} else {
this.value = value;
}
}

public static BuildVersion valueOf(String s) {
Expand Down

0 comments on commit ab05b73

Please sign in to comment.