Record Class ModernMaterialStore.BatchOperationResult
java.lang.Object
java.lang.Record
com.university.bookstore.api.ModernMaterialStore.BatchOperationResult
- Record Components:
successful- number of successful operationsfailed- number of failed operationserrors- list of error messages
- Enclosing interface:
ModernMaterialStore
-
Constructor Summary
ConstructorsConstructorDescriptionBatchOperationResult(int successful, int failed, List<String> errors) Creates an instance of aBatchOperationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.errors()Returns the value of theerrorsrecord component.intfailed()Returns the value of thefailedrecord component.final inthashCode()Returns a hash code value for this object.booleanChecks if all operations were successful.intReturns the value of thesuccessfulrecord component.doubleGets the success rate.final StringtoString()Returns a string representation of this record class.intGets the total number of operations.
-
Constructor Details
-
BatchOperationResult
Creates an instance of aBatchOperationResultrecord class.- Parameters:
successful- the value for thesuccessfulrecord componentfailed- the value for thefailedrecord componenterrors- the value for theerrorsrecord component
-
-
Method Details
-
isCompleteSuccess
public boolean isCompleteSuccess()Checks if all operations were successful.- Returns:
- true if no failures
-
totalOperations
public int totalOperations()Gets the total number of operations.- Returns:
- sum of successful and failed
-
successRate
public double successRate()Gets the success rate.- Returns:
- success percentage (0-100)
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
successful
public int successful()Returns the value of thesuccessfulrecord component.- Returns:
- the value of the
successfulrecord component
-
failed
-
errors
-