org.apache.avalon.meta.info
Class ReferenceDescriptor

java.lang.Object
  extended byorg.apache.avalon.meta.info.ReferenceDescriptor
All Implemented Interfaces:
Serializable

public final class ReferenceDescriptor
extends Object
implements Serializable

This reference defines the type of interface required by a component. The type corresponds to the class name of the interface implemented by component. Associated with each classname is a version object so that different versions of same interface can be represented.

Version:
$Revision: 1.9 $ $Date: 2003/07/12 21:12:06 $
Author:
Avalon Development Team
See Also:
Serialized Form

Constructor Summary
ReferenceDescriptor(String type)
          Construct a service with specified type.
ReferenceDescriptor(String classname, Version version)
          Construct a service with specified name, version and attributes.
 
Method Summary
 boolean equals(Object other)
          Compare this object with another for equality.
 String getClassname()
          Return classname of interface this reference refers to.
 Version getVersion()
          Return the version of interface.
 int hashCode()
          Returns the cashcode.
 boolean matches(ReferenceDescriptor 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

ReferenceDescriptor

public ReferenceDescriptor(String type)
                    throws NullPointerException
Construct a service with specified type.

Parameters:
type - the service type spec
Throws:
NullPointerException - if the classname is null

ReferenceDescriptor

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

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

getClassname

public String getClassname()
Return classname of interface this reference refers to.

Returns:
the classname of the Service

getVersion

public Version getVersion()
Return the version of interface.

Returns:
the version of interface

matches

public boolean matches(ReferenceDescriptor 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

Returns:
string describing service

equals

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

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.

Returns:
the hascode value


Copyright © Apache Software Foundation. All Rights Reserved.