Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Oct 16, 2023
1 parent fe70750 commit 7a258da
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class ReportObjectFactory {
public static final String OVERVIEW_FILE_NAME = "overview.json";

public static final String README_FILE_NAME = "README.txt";
public static final String README_CONTENT = "To view the results go to https://jplag.github.io/JPlag/ and drag the generated zip file onto the page.";

public static final String SUBMISSIONS_FOLDER = "files";
public static final String SUBMISSION_FILE_INDEX_FILE_NAME = "submissionFileIndex.json";
public static final Version REPORT_VIEWER_VERSION = JPlag.JPLAG_VERSION;
Expand Down Expand Up @@ -203,7 +205,7 @@ private void writeOverview(JPlagResult result, String path) {
}

private void writeReadMeFile(String path) {
new TextWriter().writeFile("Test content", path, README_FILE_NAME);
new TextWriter().writeFile(README_CONTENT, path, README_FILE_NAME);
}

private void writeSubmissionIndexFile(JPlagResult result, String path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
package de.jplag.reporting.reportobject.writer;

/**
* Responsible for writing a specific file type to the disk.
* @param <T> Object that the FileWriter writes.
*/
public interface FileWriter<T> {

/**
* Saves the provided object to the provided path under the provided name
* @param fileContent The object to save
* @param folderPath The path to save the object to
* @param fileName The name to save the object under
*/
void writeFile(T fileContent, String folderPath, String fileName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@

import com.fasterxml.jackson.databind.ObjectMapper;

/**
* Writes an object with {@link com.fasterxml.jackson.annotation.JsonProperty}s to the disk.
*/
public class JsonWriter implements FileWriter<Object> {
private static final Logger logger = LoggerFactory.getLogger(JsonWriter.class);

private static final ObjectMapper objectMapper = new ObjectMapper();

/**
* Saves the provided object to the provided path under the provided name
* @param fileToSave The object to save
* @param folderPath The path to save the object to
* @param fileName The name to save the object under
*/
@Override
public void writeFile(Object fileToSave, String folderPath, String fileName) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Writes plain text to a file.
*/
public class TextWriter implements FileWriter<String> {

private static final Logger logger = LoggerFactory.getLogger(TextWriter.class);
Expand Down

0 comments on commit 7a258da

Please sign in to comment.