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 StringDelimiter.private static final StringDelimiter constant.private static final StringHex 00.private static final StringHex 01.private static final StringHex 33.private static final StringHex 5e.private static final StringHex ff.private static final StringIllegal delimiter character constant.private static final StringIllegal delimiter length constant.private static final PatternIP V6 regexp.private static final PatternIP V6 separator regexp.private final String[]MAC address parts.private static final StringByte separator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(MACAddress obj) Compare with another object.booleanIs equal with another object.getOUI()Get OUI (Organizationally Unique Identifier).inthashCode()Calculate hash code.booleanIs broadcast address.booleanisGroup()Is group.booleanIs IP v4 multicast mac.booleanIs IP v6 multicast mac.booleanisLocal()Is local.booleanisVRRP()Is VRRP mac (Virtual Router Redundancy Protocol).static MACAddressMACAddress 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:
stringValuein 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:
compareToin interfaceComparable<MACAddress>- Parameters:
obj- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-