public class InetAddressPropertyType extends PropertyType<InetAddress>
java.net.InetAddress
. InetAddress.getByName(value)
. IP4AddressPropertyType
An IP address is either a 32-bit or 128-bit unsigned number used by IP, a lower-level protocol on which protocols like UDP and TCP are built. The IP address architecture is defined by RFC 790: Assigned Numbers, RFC 1918: Address Allocation for Private Internets, RFC 2365: Administratively Scoped IP Multicast, and RFC 2373: IP Version 6 Addressing Architecture. An instance of an InetAddress consists of an IP address and possibly its corresponding host name (depending on whether it is constructed with a host name or whether it has already done reverse host name resolution).
Constructor Example | Comments | ||
---|---|---|---|
Property<InetAddress> A_PROPERTY = new Property<InetAddress>("name", new InetAddressPropertyType()); |
Creates InetAddressPropertyType with no default value. | ||
Property<InetAddress> A_PROPERTY = new Property<InetAddress>("name", new InetAddressPropertyType("127.0.0.1")); |
Default value is new InetAddress("127.0.0.1") . |
||
Type of value(s) | Examples | Result | Comments |
Valid | 192.168.0.1 | InetAddressPropertyType("192.168.0.1") | Validate successfully. |
Valid | localhost | InetAddressPropertyType("localhost") | Validate successfully. |
Valid | www.nba.com | InetAddressPropertyType("www.nba.com") | Validate successfully. |
Valid | www.nba.com/195.59.44.33 | InetAddressPropertyType("www.nba.com/195.59.44.33") | Validate successfully. |
Valid | /195.59.44.33 | InetAddressPropertyType("/195.59.44.33") | Validate successfully. |
Invalid | cow | null |
Validate will throw an exception. The resulting value is null . |
Invalid | «empty string» | null |
|
Invalid | «empty string after trim» | null |
|
Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
InetAddress
,
InetAddress.getByName(String)
,
IP4AddressPropertyType
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of InetAddressPropertyType
|
Constructor and Description |
---|
InetAddressPropertyType() |
InetAddressPropertyType(InetAddress defaultValue) |
InetAddressPropertyType(String defaultValue) |
Modifier and Type | Method and Description |
---|---|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
InetAddress |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateConstraints, validateNullType
public static final String TYPE
public InetAddressPropertyType() throws NullPointerException
NullPointerException
public InetAddressPropertyType(InetAddress defaultValue) throws NullPointerException
NullPointerException
public InetAddressPropertyType(String defaultValue) throws NullPointerException
NullPointerException
public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<InetAddress>
public InetAddress validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<InetAddress>
propertyName
- the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value
- the string representation of the propertyPropertyException
- if the conversion failed.