Record Class ParseResult<M extends PackageManifest>
java.lang.Object
java.lang.Record
dev.jcputney.elearning.parser.api.ParseResult<M>
- Type Parameters:
M- The type of package manifest associated with the module- Record Components:
validation- The validation result containing any errors or warnings foundmetadata- The extracted module metadata (always present, even if validation failed)
public record ParseResult<M extends PackageManifest>(ValidationResult validation, ModuleMetadata<M extends PackageManifest> metadata)
extends Record
Result of parsing and validating an eLearning module. Contains both the validation result and the
extracted metadata.
This record is returned by ModuleParser.parseAndValidate() to provide both validation
feedback and parsed content in a single operation, eliminating the need to parse the manifest
twice.
-
Constructor Summary
ConstructorsConstructorDescriptionParseResult(ValidationResult validation, ModuleMetadata<M> metadata) Creates an instance of aParseResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanChecks if the module has any validation errors.final inthashCode()Returns a hash code value for this object.booleanChecks if the module has any validation warnings.booleanisValid()Checks if the module passed validation without errors.metadata()Returns the value of themetadatarecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevalidationrecord component.
-
Constructor Details
-
ParseResult
Creates an instance of aParseResultrecord class.- Parameters:
validation- the value for thevalidationrecord componentmetadata- the value for themetadatarecord component
-
-
Method Details
-
isValid
public boolean isValid()Checks if the module passed validation without errors. Warnings are not considered failures.- Returns:
- true if validation passed (no errors), false otherwise
-
hasErrors
public boolean hasErrors()Checks if the module has any validation errors.- Returns:
- true if there are validation errors, false otherwise
-
hasWarnings
public boolean hasWarnings()Checks if the module has any validation warnings.- Returns:
- true if there are validation warnings, false otherwise
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
validation
Returns the value of thevalidationrecord component.- Returns:
- the value of the
validationrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-