net.sourceforge.jsdp.util
Class Address

java.lang.Object
  extended by net.sourceforge.jsdp.util.Address
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Resource

public class Address
extends Object
implements Cloneable, Serializable

A generic SDP network address. There are three network address types:

Since:
0.1.0
Version:
1.0
Author:
Claudio Di Vita
See Also:
Serialized Form

Field Summary
protected  String address
          The network address
protected  String addressType
          The address type
static String IN
          The Internet network type
static String IP4
          The IP4 address type
static String IP6
          The IP6 address type
 
Constructor Summary
protected Address()
          Creates a new Address.
  Address(String address)
          Creates a new Address.
 
Method Summary
 Object clone()
          Returns a clone of this address.
 boolean equals(Object object)
          Compare for equality of hosts.
 String getAddress()
          Returns the address value.
 String getAddressType()
          Returns the address type.
 boolean isFQDN()
          Indicate if the address is a Fully Qualified Domain Name (and not an IP4 or IP6 address).
static boolean isFQDN(String address)
          Indicate if an address is a Fully Qualified Domain Name (and not an IP4 or IP6 address)
 boolean isIPAddress()
          Indicates if the address is an IP address (and not a Fully Qualified Domain name).
 void setAddress(String address)
          Sets the address value
 String toString()
          Returns a string representation of the address.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IN

public static final String IN
The Internet network type

See Also:
Constant Field Values

IP4

public static final String IP4
The IP4 address type

See Also:
Constant Field Values

IP6

public static final String IP6
The IP6 address type

See Also:
Constant Field Values

address

protected String address
The network address


addressType

protected String addressType
The address type

Constructor Detail

Address

protected Address()
Creates a new Address.


Address

public Address(String address)
        throws SDPException
Creates a new Address.

Parameters:
address - the address value
Throws:
SDPException - if the address is not valid
Method Detail

isFQDN

public static boolean isFQDN(String address)
Indicate if an address is a Fully Qualified Domain Name (and not an IP4 or IP6 address)

Parameters:
address - the address to check
Returns:
true if the address is a Fully Qualified Domain Name, false otherwise

clone

public Object clone()
Returns a clone of this address.

Overrides:
clone in class Object
Returns:
a clone of this address

equals

public boolean equals(Object object)
Compare for equality of hosts. Host names are compared by textual equality. No dns lookup is performed.

Overrides:
equals in class Object
Parameters:
object - object to compare
Returns:
true if two address are equals, false otherwise

getAddress

public String getAddress()
Returns the address value.

Returns:
the address value

getAddressType

public String getAddressType()
Returns the address type. Possible values are:

Returns:
the address type

isFQDN

public boolean isFQDN()
Indicate if the address is a Fully Qualified Domain Name (and not an IP4 or IP6 address).

Returns:
true if the address is a Fully Qualified Domain Name, false otherwise

isIPAddress

public boolean isIPAddress()
Indicates if the address is an IP address (and not a Fully Qualified Domain name).

Returns:
true if is an IP address, false otherwise

setAddress

public void setAddress(String address)
                throws SDPException
Sets the address value

Parameters:
address - the address value to set
Throws:
SDPException - if the address is not valid

toString

public String toString()
Returns a string representation of the address.

Overrides:
toString in class Object
Returns:
The string representation of the address


Copyright © 2004-2008. All Rights Reserved.