jw3 commented on a change in pull request #520:
URL: https://github.com/apache/daffodil/pull/520#discussion_r610068467
##########
File path: daffodil-lib/src/main/scala/org/apache/daffodil/api/Validator.scala
##########
@@ -54,20 +55,31 @@ trait ValidatorFactory {
/**
* Results of a validation execution
- * @param warnings [[org.apache.daffodil.api.ValidationWarning]] objects
- * @param errors [[org.apache.daffodil.api.ValidationFailure]] objects
*/
-final case class ValidationResult(warnings:
java.util.Collection[ValidationWarning], errors:
java.util.Collection[ValidationFailure])
+trait ValidationResult {
+ def warnings(): java.util.Collection[ValidationWarning]
+ def errors(): java.util.Collection[ValidationFailure]
+}
+
+/**
+ * Provider of raw validation output
+ */
+trait RawValidationResult {
+ def rawValidationData(): Array[Byte]
+}
object ValidationResult {
/**
* an empty [[org.apache.daffodil.api.ValidationResult]]
*/
val empty: ValidationResult = ValidationResult(Seq.empty, Seq.empty)
- def apply(warnings: Seq[ValidationWarning], errors: Seq[ValidationFailure]):
ValidationResult = {
+ def apply(w: Seq[ValidationWarning], e: Seq[ValidationFailure]):
ValidationResult = {
import scala.collection.JavaConverters.asJavaCollectionConverter
- ValidationResult(warnings.asJavaCollection, errors.asJavaCollection)
+ new ValidationResult{
+ val warnings: java.util.Collection[ValidationWarning] =
w.asJavaCollection
+ val errors: java.util.Collection[ValidationFailure] = e.asJavaCollection
+ }
Review comment:
Good point. IIRC this path was taken for ease of transition in the
JAPI, and it was done in the original refactor PR, not new here.
But looking back now it probably should be a scala type and converted in the
JAPI. Ill see what a refactor here looks like.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]