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 Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for theaddressBitsrecord component.private final @NonNull BigIntegerThe field for themaskedAddressrecord component.The field for theoriginalSubnetrecord component.private final @NonNull BigIntegerThe field for thevariableBitsMaskrecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateParsedAllowlistEntry(int addressBits, @NonNull String originalSubnet, @NonNull BigInteger maskedAddress, @NonNull BigInteger variableBitsMask) Creates an instance of aParsedAllowlistEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(int addressBits, @NonNull BigInteger address) Checks if the given address matches the wrapped address.intReturns the value of theaddressBitsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themaskedAddressrecord component.Returns the value of theoriginalSubnetrecord component.Parses the given subnet into an allowlist entry, if possible.final StringtoString()Returns a string representation of this record class.Returns the value of thevariableBitsMaskrecord component.
-
Field Details
-
addressBits
private final int addressBitsThe field for theaddressBitsrecord component. -
originalSubnet
The field for theoriginalSubnetrecord component. -
maskedAddress
The field for themaskedAddressrecord component. -
variableBitsMask
The field for thevariableBitsMaskrecord component.
-
-
Constructor Details
-
ParsedAllowlistEntry
private ParsedAllowlistEntry(int addressBits, @NonNull @NonNull String originalSubnet, @NonNull @NonNull BigInteger maskedAddress, @NonNull @NonNull BigInteger variableBitsMask) Creates an instance of aParsedAllowlistEntryrecord class.- Parameters:
addressBits- the value for theaddressBitsrecord componentoriginalSubnet- the value for theoriginalSubnetrecord componentmaskedAddress- the value for themaskedAddressrecord componentvariableBitsMask- the value for thevariableBitsMaskrecord component
-
-
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
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
-
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. -
addressBits
public int addressBits()Returns the value of theaddressBitsrecord component.- Returns:
- the value of the
addressBitsrecord component
-
originalSubnet
Returns the value of theoriginalSubnetrecord component.- Returns:
- the value of the
originalSubnetrecord component
-
maskedAddress
Returns the value of themaskedAddressrecord component.- Returns:
- the value of the
maskedAddressrecord component
-
variableBitsMask
Returns the value of thevariableBitsMaskrecord component.- Returns:
- the value of the
variableBitsMaskrecord component
-