Record Class IpAllowlist.ParsedAllowlistEntry

java.lang.Object
java.lang.Record
eu.cloudnetservice.node.impl.util.IpAllowlist.ParsedAllowlistEntry
Record Components:
addressBits - the number of bits that are in the parsed address.
originalSubnet - the original subnet that was parsed.
maskedAddress - the masked subnet address where the dynamic part zeroed out.
variableBitsMask - the mask used for zeroing out the dynamic part of the address.
Enclosing class:
IpAllowlist

private static record IpAllowlist.ParsedAllowlistEntry(int addressBits, @NonNull String originalSubnet, @NonNull BigInteger maskedAddress, @NonNull BigInteger variableBitsMask) extends Record
An allowlist entry that was parsed from a subnet.
Since:
4.0
  • Field Details

  • Constructor Details

  • Method Details

    • parse

      Parses the given subnet into an allowlist entry, if possible. Returns null if the subnet couldn't be parsed. Note that this method does not throw any exceptions on a parsing failure; they are just logged.
      Parameters:
      subnet - the subnet to parse and convert.
      Returns:
      the parsed subnet, null if parsing was not possible.
      Throws:
      NullPointerException - if the given subnet is null.
    • accepts

      public boolean accepts(int addressBits, @NonNull @NonNull BigInteger address)
      Checks if the given address matches the wrapped address. This is if the static part of the wrapped address equals the same part in the given address.
      Parameters:
      addressBits - the number of bits that are in the given address.
      address - the address to check, in big integer representation.
      Returns:
      true if the given address matches the wrapped address, false otherwise.
      Throws:
      NullPointerException - if the given address is null.
    • 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.
    • addressBits

      public int addressBits()
      Returns the value of the addressBits record component.
      Returns:
      the value of the addressBits record component
    • originalSubnet

      @NonNull public @NonNull String originalSubnet()
      Returns the value of the originalSubnet record component.
      Returns:
      the value of the originalSubnet record component
    • maskedAddress

      @NonNull public @NonNull BigInteger maskedAddress()
      Returns the value of the maskedAddress record component.
      Returns:
      the value of the maskedAddress record component
    • variableBitsMask

      @NonNull public @NonNull BigInteger variableBitsMask()
      Returns the value of the variableBitsMask record component.
      Returns:
      the value of the variableBitsMask record component