|
18 | 18 |
|
19 | 19 | package org.entur.gbfs.validation.model; |
20 | 20 |
|
21 | | -import java.util.Collections; |
22 | 21 | import java.util.List; |
23 | 22 | import java.util.Objects; |
24 | 23 | import java.util.stream.IntStream; |
25 | 24 |
|
26 | | -public class FileValidationResult implements ValidationResultComponentIdentity<FileValidationResult> { |
27 | | - private String file; |
28 | | - private boolean required; |
29 | | - private boolean exists; |
30 | | - private int errorsCount; |
31 | | - private String schema; |
32 | | - private String fileContents; |
33 | | - private String version; |
34 | | - private List<FileValidationError> errors = Collections.emptyList(); |
35 | | - |
36 | | - public String getFile() { |
37 | | - return file; |
38 | | - } |
39 | | - |
40 | | - public void setFile(String file) { |
41 | | - this.file = file; |
42 | | - } |
43 | | - |
44 | | - public boolean isRequired() { |
45 | | - return required; |
46 | | - } |
47 | | - |
48 | | - public void setRequired(boolean required) { |
49 | | - this.required = required; |
50 | | - } |
51 | | - |
52 | | - public boolean isExists() { |
53 | | - return exists; |
54 | | - } |
55 | | - |
56 | | - public void setExists(boolean exists) { |
57 | | - this.exists = exists; |
58 | | - } |
59 | | - |
60 | | - public int getErrorsCount() { |
61 | | - return errorsCount; |
62 | | - } |
63 | | - |
64 | | - public void setErrorsCount(int errorsCount) { |
65 | | - this.errorsCount = errorsCount; |
66 | | - } |
67 | | - |
68 | | - public String getSchema() { |
69 | | - return schema; |
70 | | - } |
71 | | - |
72 | | - public void setSchema(String schema) { |
73 | | - this.schema = schema; |
74 | | - } |
75 | | - |
76 | | - public String getFileContents() { |
77 | | - return fileContents; |
78 | | - } |
79 | | - |
80 | | - public void setFileContents(String fileContents) { |
81 | | - this.fileContents = fileContents; |
82 | | - } |
83 | | - |
84 | | - public String getVersion() { |
85 | | - return version; |
86 | | - } |
87 | | - |
88 | | - public void setVersion(String version) { |
89 | | - this.version = version; |
90 | | - } |
91 | | - |
92 | | - public List<FileValidationError> getErrors() { |
93 | | - return errors; |
94 | | - } |
95 | | - |
96 | | - public void setErrors(List<FileValidationError> errors) { |
97 | | - this.errors = errors; |
98 | | - } |
| 25 | +/** |
| 26 | + * The result of validating a single GBFS file |
| 27 | + * @param file The name of the file that was validated |
| 28 | + * @param required Whether the file is required in the given version of GBFS |
| 29 | + * @param exists Whether the file existed in the validation input |
| 30 | + * @param errorsCount The number of errors found while validating the file |
| 31 | + * @param schema The schema used to validate the file |
| 32 | + * @param fileContents The contents of the file |
| 33 | + * @param version The version of the file |
| 34 | + * @param errors A list of errors encountered while validating the file |
| 35 | + */ |
| 36 | +public record FileValidationResult( |
| 37 | + String file, |
| 38 | + boolean required, |
| 39 | + boolean exists, |
| 40 | + int errorsCount, |
| 41 | + String schema, |
| 42 | + String fileContents, |
| 43 | + String version, |
| 44 | + List<FileValidationError> errors |
| 45 | +) implements ValidationResultComponentIdentity<FileValidationResult> { |
99 | 46 |
|
100 | 47 | @Override |
101 | 48 | public String toString() { |
|
0 commit comments