net.dpml.metro.info
Class ServiceDescriptor

java.lang.Object
  extended by net.dpml.metro.info.ServiceDescriptor
All Implemented Interfaces:
Serializable

public final class ServiceDescriptor
extends Object
implements Serializable

This ServiceDescriptor defines the interface and service version published by a service instance.

Version:
1.2.0
Author:
Digital Product Meta Library
See Also:
Serialized Form

Constructor Summary
ServiceDescriptor(String spec)
          Construct a service with specified type.
ServiceDescriptor(String classname, Version version)
          Construct a service with specified name, version.
 
Method Summary
 boolean equals(Object other)
          Compare this object with another for equality.
 String getClassname()
          Return classname of service specification.
 Version getVersion()
          Return the service version.
 int hashCode()
          Returns the cashcode.
 boolean matches(ServiceDescriptor other)
          Determine if specified service will match this service.
 String toString()
          Convert to a string of format name:version
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceDescriptor

public ServiceDescriptor(String spec)
                  throws NullPointerException
Construct a service with specified type. The type argument will be parsed for a classname and version in the form [classname]#[version]. If not version is present a default 1.0.0 version will be assigned.

Parameters:
spec - the service specification
Throws:
NullPointerException - if the spec is null

ServiceDescriptor

public ServiceDescriptor(String classname,
                         Version version)
                  throws NullPointerException
Construct a service with specified name, version.

Parameters:
classname - the name of the service
version - the version of service
Throws:
NullPointerException - if the classname or version is null
Method Detail

getClassname

public String getClassname()
Return classname of service specification.

Returns:
the classname of the service specification

getVersion

public Version getVersion()
Return the service version.

Returns:
the version of interface

matches

public boolean matches(ServiceDescriptor other)
Determine if specified service will match this service. To match a service has to have same name and must comply with version.

Parameters:
other - the other ServiceInfo
Returns:
true if matches, false otherwise

toString

public String toString()
Convert to a string of format name:version

Overrides:
toString in class Object
Returns:
string describing service

equals

public boolean equals(Object other)
Compare this object with another for equality.

Overrides:
equals in class Object
Parameters:
other - the object to compare this object with
Returns:
TRUE if the supplied object is a reference, service, or service descriptor that matches this objct in terms of classname and version

hashCode

public int hashCode()
Returns the cashcode.

Overrides:
hashCode in class Object
Returns:
the hascode value