Class CrossOverDescriptor<T>
- java.lang.Object
-
- org.glassfish.hk2.utilities.DescriptorImpl
-
- org.glassfish.hk2.utilities.AbstractActiveDescriptor<T>
-
- org.glassfish.hk2.extras.hk2bridge.internal.CrossOverDescriptor<T>
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,ActiveDescriptor<T>
,Descriptor
,SingleCache<T>
public class CrossOverDescriptor<T> extends AbstractActiveDescriptor<T>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private ActiveDescriptor<T>
remote
private ServiceLocator
remoteLocator
private boolean
remoteReified
-
Constructor Summary
Constructors Constructor Description CrossOverDescriptor(ServiceLocator local, ActiveDescriptor<T> localService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkState()
T
create(ServiceHandle<?> root)
Creates an instance of the ActiveDescriptor.void
dispose(T instance)
Disposes this instance.java.util.Set<java.lang.reflect.Type>
getContractTypes()
The set of types that this ActiveDescriptor must produce.java.lang.Long
getFactoryLocatorId()
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service.java.lang.Long
getFactoryServiceId()
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service.java.lang.Class<?>
getImplementationClass()
The implementation class that should be used to generate new instances of this descriptor.java.lang.reflect.Type
getImplementationType()
If known the Type of the implementation.java.util.List<Injectee>
getInjectees()
Returns the full list of Injectees this class has.java.util.Set<java.lang.annotation.Annotation>
getQualifierAnnotations()
The full set of qualifiers that this ActiveDescriptor providesjava.lang.Class<? extends java.lang.annotation.Annotation>
getScopeAnnotation()
Returns the scope that this ActiveDescriptor belongs tojava.lang.annotation.Annotation
getScopeAsAnnotation()
Returns the scope as anAnnotation
implementation that this ActiveDescriptor belongs toboolean
isReified()
This method returns true if this descriptor has been reified (class loaded).void
setImplementationType(java.lang.reflect.Type t)
-
Methods inherited from class org.glassfish.hk2.utilities.AbstractActiveDescriptor
addContractType, addQualifierAnnotation, equals, getCache, hashCode, isCacheSet, releaseCache, removeContractType, removeQualifierAnnotation, setCache, setFactoryId, setName, setReified, setScopeAnnotation, setScopeAsAnnotation
-
Methods inherited from class org.glassfish.hk2.utilities.DescriptorImpl
addAdvertisedContract, addMetadata, addMetadata, addQualifier, clearMetadata, descriptorEquals, getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, pretty, readExternal, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setClassAnalysisName, setDescriptorType, setDescriptorVisibility, setImplementation, setLoader, setLocatorId, setMetadata, setProxiable, setProxyForSameScope, setRanking, setScope, setServiceId, toString, writeExternal, writeObject
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.glassfish.hk2.api.Descriptor
getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, setRanking
-
-
-
-
Field Detail
-
remoteLocator
private final ServiceLocator remoteLocator
-
remote
private final ActiveDescriptor<T> remote
-
remoteReified
private boolean remoteReified
-
-
Constructor Detail
-
CrossOverDescriptor
public CrossOverDescriptor(ServiceLocator local, ActiveDescriptor<T> localService)
-
-
Method Detail
-
isReified
public boolean isReified()
This method returns true if this descriptor has been reified (class loaded). If this method returns false then the other methods in this interface will throw an IllegalStateException. Once this method returns true it may be- Specified by:
isReified
in interfaceActiveDescriptor<T>
- Overrides:
isReified
in classAbstractActiveDescriptor<T>
- Returns:
- true if this descriptor has been reified, false otherwise
-
checkState
private void checkState()
-
getImplementationClass
public java.lang.Class<?> getImplementationClass()
Description copied from interface:ActiveDescriptor
The implementation class that should be used to generate new instances of this descriptor.If the class returned is a Factory, then the factory is used to create instances. In this case the system will get an instance of the factory and use it to create the instances
- Returns:
- The class that directly implements the contract types, or the class that is the factory for an object that implements the contract types
-
getImplementationType
public java.lang.reflect.Type getImplementationType()
Description copied from interface:ActiveDescriptor
If known the Type of the implementation. If unknown will return the same asActiveDescriptor.getImplementationClass()
- Returns:
- The type of the implementation or the implementation class
-
setImplementationType
public void setImplementationType(java.lang.reflect.Type t)
- Overrides:
setImplementationType
in classAbstractActiveDescriptor<T>
-
getContractTypes
public java.util.Set<java.lang.reflect.Type> getContractTypes()
Description copied from interface:ActiveDescriptor
The set of types that this ActiveDescriptor must produce. These types may be Classes or ParameterizedTypes, and may be no other subclass of Type- Specified by:
getContractTypes
in interfaceActiveDescriptor<T>
- Overrides:
getContractTypes
in classAbstractActiveDescriptor<T>
- Returns:
- the set of types this ActiveDescriptor must implement or extend
-
getScopeAsAnnotation
public java.lang.annotation.Annotation getScopeAsAnnotation()
Description copied from interface:ActiveDescriptor
Returns the scope as anAnnotation
implementation that this ActiveDescriptor belongs to- Specified by:
getScopeAsAnnotation
in interfaceActiveDescriptor<T>
- Overrides:
getScopeAsAnnotation
in classAbstractActiveDescriptor<T>
- Returns:
- The scope of this ActiveDescriptor as an
Annotation
-
getScopeAnnotation
public java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()
Description copied from interface:ActiveDescriptor
Returns the scope that this ActiveDescriptor belongs to- Specified by:
getScopeAnnotation
in interfaceActiveDescriptor<T>
- Overrides:
getScopeAnnotation
in classAbstractActiveDescriptor<T>
- Returns:
- The scope of this ActiveDescriptor
-
getQualifierAnnotations
public java.util.Set<java.lang.annotation.Annotation> getQualifierAnnotations()
Description copied from interface:ActiveDescriptor
The full set of qualifiers that this ActiveDescriptor provides- Specified by:
getQualifierAnnotations
in interfaceActiveDescriptor<T>
- Overrides:
getQualifierAnnotations
in classAbstractActiveDescriptor<T>
- Returns:
- The set of annotations that this ActiveDescriptor provides
-
getInjectees
public java.util.List<Injectee> getInjectees()
Description copied from interface:ActiveDescriptor
Returns the full list of Injectees this class has. These references will be resolved prior to the class being constructed, even if these injectees are field or method injectees.If this descriptor is describing a factory created type then this list must have zero length
- Specified by:
getInjectees
in interfaceActiveDescriptor<T>
- Overrides:
getInjectees
in classAbstractActiveDescriptor<T>
- Returns:
- Will not return null, but may return an empty list. The set of Injectees that must be resolved before this ActiveDescriptor can be constructed
-
getFactoryServiceId
public java.lang.Long getFactoryServiceId()
Description copied from interface:ActiveDescriptor
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service. Otherwise this method should return null- Specified by:
getFactoryServiceId
in interfaceActiveDescriptor<T>
- Overrides:
getFactoryServiceId
in classAbstractActiveDescriptor<T>
- Returns:
- The service ID of the associated factory service
-
getFactoryLocatorId
public java.lang.Long getFactoryLocatorId()
Description copied from interface:ActiveDescriptor
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service. Otherwise this method should return null- Specified by:
getFactoryLocatorId
in interfaceActiveDescriptor<T>
- Overrides:
getFactoryLocatorId
in classAbstractActiveDescriptor<T>
- Returns:
- The locator ID of the associated factory service
-
create
public T create(ServiceHandle<?> root)
Description copied from interface:ActiveDescriptor
Creates an instance of the ActiveDescriptor. All of the Injectee's must be created prior to instantiation, and associated with the ExtendedProvider so that they can be destroyed properly- Parameters:
root
- The root service handle, which can be used to associated all the PerLookup objects with this creation- Returns:
- An instance of this ActiveDescriptor
-
dispose
public void dispose(T instance)
Description copied from interface:ActiveDescriptor
Disposes this instance. All the PerLookup objects that were created for this instance will be destroyed after this object has been destroyed- Specified by:
dispose
in interfaceActiveDescriptor<T>
- Overrides:
dispose
in classAbstractActiveDescriptor<T>
- Parameters:
instance
- The instance to destroy
-
-