Qwylt

java.lang.module
Class ServiceType<T>

java.lang.Object
  extended by java.lang.module.AttributeSource
      extended by java.lang.module.ScopedName
          extended by java.lang.module.ExportMatcher
              extended by java.lang.module.ServiceType<T>
All Implemented Interfaces:
Matcher<Export>

public class ServiceType<T>
extends ExportMatcher

An ExportMatcher that describes a service interface.

Since:
Jan 24, 2010
Author:
Bryan Atsatt.

Nested Class Summary
static class ServiceType.ParameterizedClass<T>
          A wrapper for parameterized class literals.
 
Nested classes/interfaces inherited from class java.lang.module.ScopedName
ScopedName.Scope
 
Field Summary
 
Fields inherited from class java.lang.module.ExportMatcher
attributeMatcher, versionMatcher
 
Fields inherited from class java.lang.module.AttributeSource
NO_ATTRIBUTES, SERVICE_IMPLEMENTATION_KEY
 
Constructor Summary
ServiceType(java.lang.Class<T> serviceType)
          Constructor.
ServiceType(java.lang.Class<T> serviceType, Matcher<Version> versionMatcher)
          Constructor.
ServiceType(java.lang.Class<T> serviceType, Matcher<Version> versionMatcher, AttributeMatcher attributeMatcher)
          Constructor.
ServiceType(java.lang.Class<T> serviceType, Matcher<Version> versionMatcher, AttributeMatcher attributeMatcher, Matcher<java.lang.Class<T>> serviceMatcher)
          Constructor.
ServiceType(ServiceType.ParameterizedClass<T> serviceType)
          Constructor.
ServiceType(ServiceType.ParameterizedClass<T> serviceType, Matcher<Version> versionMatcher)
          Constructor.
ServiceType(ServiceType.ParameterizedClass<T> serviceType, Matcher<Version> versionMatcher, AttributeMatcher attributeMatcher)
          Constructor.
ServiceType(ServiceType.ParameterizedClass<T> serviceType, Matcher<Version> versionMatcher, AttributeMatcher attributeMatcher, Matcher<java.lang.Class<T>> serviceMatcher)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object other)
          Test if the specified object is equal to this instance
 boolean equals(ServiceType other)
          Test if the specified object is equal to this instance
 Matcher<java.lang.Class<T>> getServiceMatcher()
          Returns the service matcher.
 java.lang.Class<T> getType()
          Returns the service interface type.
 int hashCode()
          Returns the hash code for this instance.
 boolean isAssignableFrom(java.lang.Class<T> serviceClass)
          Returns true iff the specified class is assignable to the interface class and matches the service matcher if present.
 
Methods inherited from class java.lang.module.ExportMatcher
containsAttribute, getAttribute, getAttributeKeys, getAttributeMatcher, getAttributes, getVersionMatcher, matches, toString
 
Methods inherited from class java.lang.module.ScopedName
getName, getScope, scopedNameEquals, scopedNameEquals, scopedNameHashCode, scopedNameHashCode
 
Methods inherited from class java.lang.module.AttributeSource
appendAttributes, asList, containsAttributes, getAttributeAsList, modifiableList, unmodifiableMap, unmodifiableMap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceType

public ServiceType(java.lang.Class<T> serviceType)
Constructor.

Parameters:
serviceType - The service type.

ServiceType

public ServiceType(ServiceType.ParameterizedClass<T> serviceType)
Constructor.

Parameters:
serviceType - The service type.

ServiceType

public ServiceType(java.lang.Class<T> serviceType,
                   Matcher<Version> versionMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.

ServiceType

public ServiceType(ServiceType.ParameterizedClass<T> serviceType,
                   Matcher<Version> versionMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.

ServiceType

public ServiceType(java.lang.Class<T> serviceType,
                   Matcher<Version> versionMatcher,
                   AttributeMatcher attributeMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.
attributeMatcher - The attribute matcher. May be null to match any attributes.

ServiceType

public ServiceType(ServiceType.ParameterizedClass<T> serviceType,
                   Matcher<Version> versionMatcher,
                   AttributeMatcher attributeMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.
attributeMatcher - The attribute matcher. May be null to match any attributes.

ServiceType

public ServiceType(java.lang.Class<T> serviceType,
                   Matcher<Version> versionMatcher,
                   AttributeMatcher attributeMatcher,
                   Matcher<java.lang.Class<T>> serviceMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.
attributeMatcher - The attribute matcher. May be null to match any attributes.
serviceMatcher - The service matcher. May be null to match any class that is assignable to the service interface.

ServiceType

public ServiceType(ServiceType.ParameterizedClass<T> serviceType,
                   Matcher<Version> versionMatcher,
                   AttributeMatcher attributeMatcher,
                   Matcher<java.lang.Class<T>> serviceMatcher)
Constructor.

Parameters:
serviceType - The service type.
versionMatcher - The version matcher. May be null to match any version.
attributeMatcher - The attribute matcher. May be null to match any attributes.
serviceMatcher - The service matcher. May be null to match any class that is assignable to the service interface.
Method Detail

getType

public java.lang.Class<T> getType()
Returns the service interface type.

Returns:
The type.

getServiceMatcher

public Matcher<java.lang.Class<T>> getServiceMatcher()
Returns the service matcher.

Returns:
The service matcher or null if none.

isAssignableFrom

public boolean isAssignableFrom(java.lang.Class<T> serviceClass)
Returns true iff the specified class is assignable to the interface class and matches the service matcher if present.

Parameters:
serviceClass - The class to test.
Returns:
true if the class is assignable.

equals

public boolean equals(java.lang.Object other)
Test if the specified object is equal to this instance

Overrides:
equals in class java.lang.Object
Parameters:
other - The object to compare to.
Returns:
true if other is equal to this instance; otherwise, returns false.

equals

public boolean equals(ServiceType other)
Test if the specified object is equal to this instance

Parameters:
other - The object to compare to.
Returns:
true if other is equal to this instance; otherwise, returns false.

hashCode

public int hashCode()
Returns the hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this instance.

Qwylt

Send comments or questions to Bryan Atsatt