Cleaned up alternate example class template

This commit is contained in:
Erik C. Thauvin 2024-07-11 09:25:35 -07:00
parent c4f143ae02
commit e8a12857b8
Signed by: erik
GPG key ID: 776702A6A2DA330E
3 changed files with 32 additions and 19 deletions

View file

@ -0,0 +1,30 @@
package {{v packageName/}};
import java.util.Date;
public final class {{v className/}} implements Comparable<{{v className/}}> {
public static final String PROJECT = "{{v project/}}";
public static final Date BUILD_DATE = new Date({{v epoch/}}L);
public static final int MAJOR = {{v major/}};
public static final int MINOR = {{v minor/}};
public static final int REVISION = {{v revision/}};
public static final String QUALIFIER = "{{v qualifier/}}";
public static final String VERSION = "{{v version/}}";
private {{v className/}}() {
// no-op
}
@Override
public int compareTo({{v className/}} other) {
if (MAJOR != other.MAJOR) {
return Integer.compare(MAJOR, other.MAJOR);
} else if (MINOR != other.MINOR) {
return Integer.compare(MINOR, other.MINOR);
} else if (REVISION != other.REVISION) {
return Integer.compare(REVISION, other.REVISION);
} else {
return QUALIFIER.compareTo(other.QUALIFIER);
}
}
}

View file

@ -1,17 +0,0 @@
package {{v packageName/}};
import java.util.Date;
public final class {{v className/}} {
public static final String PROJECT = "{{v project/}}";
public static final Date BUILD_DATE = new Date({{v epoch/}}L);
public static final int MAJOR = {{v major/}};
public static final int MINOR = {{v minor/}};
public static final int REVISION = {{v revision/}};
public static final String QUALIFIER = "{{v qualifier/}}";
public static final String VERSION = "{{v version/}}";
private {{v className/}}() {
// no-op
}
}

View file

@ -45,8 +45,8 @@ public class SampleBuild extends Project {
public void genver() throws Exception {
new GeneratedVersionOperation()
.fromProject(this)
// .projectName("My App")
// .classTemplate("myversion.txt")
.projectName("My App")
.classTemplate("my_app_version.txt")
.execute();
}
}