Record Class BankConnection

java.lang.Object
java.lang.Record
net.tangly.core.BankConnection
Record Components:
iban - iban of the bank connection
bic - bic of the bank connection
institute - institute of the bank connection

public record BankConnection(@NotNull String iban, String bic, String institute) extends Record
Describes a bank connection with IBAN account number, BIC identification and name of the institute. The class is immutable.
  • Constructor Details

    • BankConnection

      public BankConnection(@NotNull @NotNull String iban, String bic, String institute)
      Creates an instance of a BankConnection record class.
      Parameters:
      iban - the value for the iban record component
      bic - the value for the bic record component
      institute - the value for the institute record component
    • BankConnection

      public BankConnection(@NotNull @NotNull String iban)
    • BankConnection

      public BankConnection(@NotNull @NotNull String iban, String bic)
  • Method Details

    • of

      public static BankConnection of(@NotNull @NotNull String iban, String bic, String institute)
      Factory method to construct a bank connection.
      Parameters:
      iban - iban of the bank connection
      bic - bic of the bank connection
      institute - institute of the bank connection
      Returns:
      new bank connection
    • of

      public static BankConnection of(@NotNull @NotNull String text)
      Builds a bank connection object from a comma separated string representation.
      Parameters:
      text - comma separated representation of the address instance
      Returns:
      new address object
      See Also:
    • validateIban

      public static boolean validateIban(@NotNull @NotNull String iban)
      Validates a string representing a formatted iban number.
      Parameters:
      iban - iban number to validate
      Returns:
      true, if iban is valid otherwise false
    • validateBic

      public static boolean validateBic(String bic)
      Validates a string representing a formatted bic number.
      Parameters:
      bic - bic number to validate
      Returns:
      true, if the bic is valid otherwise false
    • text

      public String text()
      Returns a comma-separated representation of a bank connection. Null values are shown as empty strings. The Object.toString() method is not used because the implementation is defined in the API implementation of record construct. The generated string can be feed to the of(String) to create a bank connection object.
      Returns:
      comma separated representation
      See Also:
    • 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.
    • iban

      @NotNull public @NotNull String iban()
      Returns the value of the iban record component.
      Returns:
      the value of the iban record component
    • bic

      public String bic()
      Returns the value of the bic record component.
      Returns:
      the value of the bic record component
    • institute

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