java.lang.Object
de.powerstat.validation.values.MACAddress
- All Implemented Interfaces:
IValueObject
,Comparable<MACAddress>
Canonical Media-Access-Control-Adresse (MAC).
TODO getManufacturer name
TODO Exists in network
http://standards-oui.ieee.org/oui/oui.csv
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Delimiter.private static final String
Delimiter constant.private static final String
Hex 00.private static final String
Hex 01.private static final String
Hex 33.private static final String
Hex 5e.private static final String
Hex ff.private static final String
Illegal delimiter character constant.private static final String
Illegal delimiter length constant.private static final Pattern
IP V6 regexp.private static final Pattern
IP V6 separator regexp.private final String[]
MAC address parts.private static final String
Byte separator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(MACAddress obj) Compare with another object.boolean
Is equal with another object.getOUI()
Get OUI (Organizationally Unique Identifier).int
hashCode()
Calculate hash code.boolean
Is broadcast address.boolean
isGroup()
Is group.boolean
Is IP v4 multicast mac.boolean
Is IP v6 multicast mac.boolean
isLocal()
Is local.boolean
isVRRP()
Is VRRP mac (Virtual Router Redundancy Protocol).static MACAddress
MACAddress factory.Returns the value of this MACADdress as a string with delimiter ':'.stringValue
(String delimiter) Returns the value of this MACAddress as a string.toString()
Returns the string representation of this MACAddress.
-
Field Details
-
H00
Hex 00.- See Also:
-
H01
Hex 01.- See Also:
-
H33
Hex 33.- See Also:
-
H5E
Hex 5e.- See Also:
-
HFF
Hex ff.- See Also:
-
SEPARATOR
Byte separator.- See Also:
-
DELIMITER
Delimiter.- See Also:
-
DELIMITER_TXT
Delimiter constant.- See Also:
-
ILLEGAL_DELIMITER_LENGTH
Illegal delimiter length constant.- See Also:
-
ILLEGAL_DELIMITER_CHARACTER
Illegal delimiter character constant.- See Also:
-
IPV6_REGEXP
IP V6 regexp. -
IPV6_SEPARATOR_REGEXP
IP V6 separator regexp. -
parts
MAC address parts.
-
-
Constructor Details
-
MACAddress
Constructor.- Parameters:
address
- MAC address- Throws:
NullPointerException
- if address is nullIllegalArgumentException
- if address is not a mac address
-
-
Method Details
-
of
MACAddress factory.- Parameters:
address
- MAC address- Returns:
- MACAddress object
-
stringValue
Returns the value of this MACAddress as a string.- Parameters:
delimiter
- Delimiter could be empty, : or -- Returns:
- The text value represented by this object after conversion to type string.
-
stringValue
Returns the value of this MACADdress as a string with delimiter ':'.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string.
-
isBroadcast
public boolean isBroadcast()Is broadcast address.- Returns:
- true if broadcast address, false otherwise
-
isGroup
public boolean isGroup()Is group.- Returns:
- true: group, false: individual
-
isLocal
public boolean isLocal()Is local.- Returns:
- true: local, false: universal
-
isIPV4Multicast
public boolean isIPV4Multicast()Is IP v4 multicast mac.- Returns:
- true if mac is an ip v4 multicast address, false otherwise
-
isIPV6Multicast
public boolean isIPV6Multicast()Is IP v6 multicast mac.- Returns:
- true if mac is an ip v6 multicast address, false otherwise
-
isVRRP
public boolean isVRRP()Is VRRP mac (Virtual Router Redundancy Protocol).- Returns:
- true if mac is a vrrp address, false otherwise
-
getOUI
Get OUI (Organizationally Unique Identifier).- Returns:
- OUI (MA-L) string 000000 TODO OUI-28 (MA-M), OUI-36 (MA-S)
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this MACAddress. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "MACAddress[address=00:00:00:00:00:00]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<MACAddress>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-