Record Class GenericWarning

java.lang.Object
java.lang.Record
co.ankatech.ankasecure.sdk.model.warning.GenericWarning
Record Components:
rawMessage - the original warning message from the API
All Implemented Interfaces:
CryptoWarning

public record GenericWarning(String rawMessage) extends Record implements CryptoWarning
Generic warning for messages that don't match known patterns.

Acts as a fallback when the API returns warnings that cannot be parsed into specific structured types. Severity is inferred from keyword analysis.

Severity detection keywords:

  • CRITICAL - "critical", "urgent", "immediate"
  • WARNING - "warning", "caution"
  • INFO - Default for unrecognized messages
Since:
3.0.0
  • Constructor Details

    • GenericWarning

      public GenericWarning(String rawMessage)
      Creates an instance of a GenericWarning record class.
      Parameters:
      rawMessage - the value for the rawMessage record component
  • Method Details

    • severity

      public WarningSeverity severity()
      Description copied from interface: CryptoWarning
      Returns the severity level of this warning.
      Specified by:
      severity in interface CryptoWarning
      Returns:
      warning severity (INFO, NOTICE, WARNING, or CRITICAL)
    • message

      public String message()
      Description copied from interface: CryptoWarning
      Returns a human-readable warning message.
      Specified by:
      message in interface CryptoWarning
      Returns:
      descriptive message
    • recommendedAction

      public String recommendedAction()
      Description copied from interface: CryptoWarning
      Returns the recommended action to address this warning.
      Specified by:
      recommendedAction in interface CryptoWarning
      Returns:
      actionable guidance for the user
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • rawMessage

      public String rawMessage()
      Returns the value of the rawMessage record component.
      Returns:
      the value of the rawMessage record component