jw3 commented on a change in pull request #520:
URL: https://github.com/apache/daffodil/pull/520#discussion_r614752116



##########
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:
       I did a refactor on this and it looks good, but grows pretty large 
considering the changes needed to keep the internal API object out of the 
external APIs.
   
   Going to follow up with a ticket like "Refactor Validation API to remove 
Java types"




-- 
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]


Reply via email to