Package org.glassfish.hk2.utilities
Class FactoryDescriptorsImpl
- java.lang.Object
-
- org.glassfish.hk2.utilities.FactoryDescriptorsImpl
-
- All Implemented Interfaces:
FactoryDescriptors
public class FactoryDescriptorsImpl extends java.lang.Object implements FactoryDescriptors
This is an implementation of FactoryDescriptors that can be used by hk2 uses when creating descriptors that describe aFactory
-
-
Field Summary
Fields Modifier and Type Field Description private Descriptor
asProvideMethod
private Descriptor
asService
-
Constructor Summary
Constructors Constructor Description FactoryDescriptorsImpl(Descriptor asService, Descriptor asProvideMethod)
This creates a descriptor pair describing aFactory
and the associatedFactory.provide()
method
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Descriptor
getFactoryAsAFactory()
This returns the factory as a factory for some other type.Descriptor
getFactoryAsAService()
This returns the factory as a service itself.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
asService
private final Descriptor asService
-
asProvideMethod
private final Descriptor asProvideMethod
-
-
Constructor Detail
-
FactoryDescriptorsImpl
public FactoryDescriptorsImpl(Descriptor asService, Descriptor asProvideMethod)
This creates a descriptor pair describing aFactory
and the associatedFactory.provide()
method- Parameters:
asService
- A description of the factory itself as an hk2 service. May not be null. Must have DescriptorType ofDescriptorType.CLASS
. One of the contracts must be FactoryasProvideMethod
- A description of the provide method of the factory. Must have DescriptorType ofDescriptorType.PROVIDE_METHOD
. May not be null- Throws:
java.lang.IllegalArgumentException
- if the descriptors are not of the proper type
-
-
Method Detail
-
getFactoryAsAService
public Descriptor getFactoryAsAService()
Description copied from interface:FactoryDescriptors
This returns the factory as a service itself. The advertised contracts must contain the implementation class of the factory and theFactory
. The descriptor type must beDescriptorType.CLASS
since this descriptor is describing the factory itself.- Specified by:
getFactoryAsAService
in interfaceFactoryDescriptors
- Returns:
- The factory as a service itself
-
getFactoryAsAFactory
public Descriptor getFactoryAsAFactory()
Description copied from interface:FactoryDescriptors
This returns the factory as a factory for some other type. The implementation class should contain the implementation class of the factory service. If the implementation class returned from this does not match the implementation class returned from getFactoryAsAService an error will occur. The contracts, name and qualifiers should represent the type returned from the provide method of the factory. The descriptor type must beDescriptorType.PROVIDE_METHOD
since this descriptor is describing the factory as a factory, not as a service.- Specified by:
getFactoryAsAFactory
in interfaceFactoryDescriptors
- Returns:
- The factory descriptor as a factory
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-