org.clazzes.util.net
Enum IPAddressType

java.lang.Object
  extended by java.lang.Enum<IPAddressType>
      extended by org.clazzes.util.net.IPAddressType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IPAddressType>

public enum IPAddressType
extends java.lang.Enum<IPAddressType>

Describes the "nature" of an IP address stored in a string or long. It is dedicated to allow a few semantic checks, e.g. IPv4 netmasks have only 1s and than only 0s. Someday we might support IPv6 addresses.

Author:
lech

Enum Constant Summary
IPv4Address
          4 byte Dotted IPv4 address, first an last byte must be non-zero.
IPv4ListenAddress
          Like IPv4Address, but may be 0.0.0.0
IPv4Netmask
          4 byte Dotted IPv4 netmask. constists of n set bits + 32-n unset bits.
IPv4Network
          4 byte Dotted IPv4 network address. first byte must be non-zero, last byte must be <255
 
Method Summary
static IPAddressType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static IPAddressType[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

IPv4Address

public static final IPAddressType IPv4Address
4 byte Dotted IPv4 address, first an last byte must be non-zero.


IPv4ListenAddress

public static final IPAddressType IPv4ListenAddress
Like IPv4Address, but may be 0.0.0.0


IPv4Netmask

public static final IPAddressType IPv4Netmask
4 byte Dotted IPv4 netmask. constists of n set bits + 32-n unset bits.


IPv4Network

public static final IPAddressType IPv4Network
4 byte Dotted IPv4 network address. first byte must be non-zero, last byte must be <255

Method Detail

values

public static final IPAddressType[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(IPAddressType c : IPAddressType.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static IPAddressType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name


Copyright © 2010. All Rights Reserved.