# Record Class ModernMaterialStore.BatchOperationResult

java.lang.Object
java.lang.Record
com.university.bookstore.api.ModernMaterialStore.BatchOperationResult

Record Components:
  `successful` - number of successful operations
  `failed` - number of failed operations
  `errors` - list of error messages

Enclosing interface:
  `ModernMaterialStore`

public static record ModernMaterialStore.BatchOperationResult(int successful, int failed, List<String> errors) extends Record
Batch operation result record.

Since:
  2024-09-15
Version:
  4.0
Author:
  Navid Mohaghegh

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BatchOperationResult(int successful, int failed, List<String> errors)`
  Creates an instance of a `BatchOperationResult` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `List<String>`
  `errors()`
  Returns the value of the `errors` record component.
  `int`
  `failed()`
  Returns the value of the `failed` record component.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `boolean`
  `isCompleteSuccess()`
  Checks if all operations were successful.
  `int`
  `successful()`
  Returns the value of the `successful` record component.
  `double`
  `successRate()`
  Gets the success rate.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `int`
  `totalOperations()`
  Gets the total number of operations.

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BatchOperationResult

    public BatchOperationResult(int successful, int failed, List<String> errors)
    Creates an instance of a `BatchOperationResult` record class.
    Parameters:
      `successful` - the value for the `successful` record component
      `failed` - the value for the `failed` record component
      `errors` - the value for the `errors` record 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

    public final String 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.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### 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.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    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 with `Objects::equals(Object,Object)`; primitive components are compared with the `compare` method from their corresponding wrapper classes.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### successful

    public int successful()
    Returns the value of the `successful` record component.
    Returns:
      the value of the `successful` record component

  - ### failed

    public int failed()
    Returns the value of the `failed` record component.
    Returns:
      the value of the `failed` record component

  - ### errors

    public List<String> errors()
    Returns the value of the `errors` record component.
    Returns:
      the value of the `errors` record component