Javadocs cleanup
This commit is contained in:
parent
31584513b0
commit
3e7250b7bb
4 changed files with 69 additions and 28 deletions
|
@ -42,8 +42,7 @@ public class GeneratedVersionOperationBuild extends Project {
|
||||||
.link("https://javadoc.io/doc/net.sourceforge.pmd/pmd-core/latest/");
|
.link("https://javadoc.io/doc/net.sourceforge.pmd/pmd-core/latest/");
|
||||||
|
|
||||||
publishOperation()
|
publishOperation()
|
||||||
.repositories(MAVEN_LOCAL,
|
.repositories(MAVEN_LOCAL, version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
||||||
version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
|
||||||
.info()
|
.info()
|
||||||
.groupId("com.uwyn.rife2")
|
.groupId("com.uwyn.rife2")
|
||||||
.artifactId("bld-generated-version")
|
.artifactId("bld-generated-version")
|
||||||
|
|
|
@ -28,57 +28,93 @@ import java.io.File;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.DataClass")
|
@SuppressWarnings("PMD.DataClass")
|
||||||
public class GeneratedVersion {
|
public class GeneratedVersion {
|
||||||
private String className;
|
|
||||||
private File classFile;
|
private File classFile;
|
||||||
|
private String className;
|
||||||
private String packageName;
|
private String packageName;
|
||||||
private BaseProject project;
|
private BaseProject project;
|
||||||
private String projectName;
|
private String projectName;
|
||||||
private File template;
|
private File template;
|
||||||
|
|
||||||
public String getClassName() {
|
/**
|
||||||
return className;
|
* Returns the class file.
|
||||||
}
|
*/
|
||||||
|
|
||||||
public void setClassName(String className) {
|
|
||||||
this.className = className;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getClassFile() {
|
public File getClassFile() {
|
||||||
return classFile;
|
return classFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClassFile(File classFile) {
|
/**
|
||||||
this.classFile = classFile;
|
* Returns the class name.
|
||||||
|
*/
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the package name.
|
||||||
|
*/
|
||||||
public String getPackageName() {
|
public String getPackageName() {
|
||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPackageName(String packageName) {
|
/**
|
||||||
this.packageName = packageName;
|
* Returns the project.
|
||||||
}
|
*/
|
||||||
|
|
||||||
public BaseProject getProject() {
|
public BaseProject getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(BaseProject project) {
|
/**
|
||||||
this.project = project;
|
* Returns the project name.
|
||||||
}
|
*/
|
||||||
|
|
||||||
public String getProjectName() {
|
public String getProjectName() {
|
||||||
return projectName;
|
return projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectName(String projectName) {
|
/**
|
||||||
this.projectName = projectName;
|
* Returns the template.
|
||||||
}
|
*/
|
||||||
|
|
||||||
public File getTemplate() {
|
public File getTemplate() {
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the class file.
|
||||||
|
*/
|
||||||
|
public void setClassFile(File classFile) {
|
||||||
|
this.classFile = classFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the class name.
|
||||||
|
*/
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the package name.
|
||||||
|
*/
|
||||||
|
public void setPackageName(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the project.
|
||||||
|
*/
|
||||||
|
public void setProject(BaseProject project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the project name.
|
||||||
|
*/
|
||||||
|
public void setProjectName(String projectName) {
|
||||||
|
this.projectName = projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the template file.
|
||||||
|
*/
|
||||||
public void setTemplate(File template) {
|
public void setTemplate(File template) {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the GeneratedVersionOperation class.
|
* Generates a project version data class.
|
||||||
*
|
*
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
|
@ -112,6 +112,9 @@ public class GeneratedVersionOperation extends AbstractOperation<GeneratedVersio
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the project version class in the given directory.
|
||||||
|
*/
|
||||||
public static void writeTemplate(Template template, File directory, GeneratedVersion gv) {
|
public static void writeTemplate(Template template, File directory, GeneratedVersion gv) {
|
||||||
if (gv.getPackageName() != null) {
|
if (gv.getPackageName() != null) {
|
||||||
gv.setClassFile(Path.of(directory.getAbsolutePath(),
|
gv.setClassFile(Path.of(directory.getAbsolutePath(),
|
||||||
|
@ -151,13 +154,16 @@ public class GeneratedVersionOperation extends AbstractOperation<GeneratedVersio
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the class template path
|
* Sets the class template path.
|
||||||
*/
|
*/
|
||||||
public GeneratedVersionOperation classTemplate(File template) {
|
public GeneratedVersionOperation classTemplate(File template) {
|
||||||
generatedVersion.setTemplate(template);
|
generatedVersion.setTemplate(template);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a version data class for this project.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if (generatedVersion.getProject() == null && LOGGER.isLoggable(Level.SEVERE)) {
|
if (generatedVersion.getProject() == null && LOGGER.isLoggable(Level.SEVERE)) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class GeneratedVersionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void buildTemplateCustomTest() {
|
void testBuildCustomTemplate() {
|
||||||
var gv = new GeneratedVersion();
|
var gv = new GeneratedVersion();
|
||||||
gv.setProject(PROJECT);
|
gv.setProject(PROJECT);
|
||||||
gv.setTemplate(new File(gv.getProject().srcTestResourcesDirectory().getAbsolutePath(),
|
gv.setTemplate(new File(gv.getProject().srcTestResourcesDirectory().getAbsolutePath(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue