java.lang.Object
org.glassfish.hk2.utilities.DescriptorImpl
org.glassfish.hk2.utilities.AbstractActiveDescriptor<T>
org.glassfish.hk2.internal.ConstantActiveDescriptor<T>
- Type Parameters:
T- The type of the constant
- All Implemented Interfaces:
Externalizable,Serializable,ActiveDescriptor<T>,Descriptor,SingleCache<T>
- Author:
- jwells
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFor serializableConstantActiveDescriptor(T theOne, Set<Type> advertisedContracts, Class<? extends Annotation> scope, String name, Set<Annotation> qualifiers, DescriptorVisibility descriptorVisibility, Boolean proxy, Boolean proxyForSameScope, String classAnalysisName, Map<String, List<String>> metadata, int rank) Creates the constant descriptor -
Method Summary
Modifier and TypeMethodDescriptioncreate(ServiceHandle<?> root) Creates an instance of the ActiveDescriptor.getCache()This can be used for scopes that will only every be created once.Returns the fully qualified class name of the implementation class.Class<?>The implementation class that should be used to generate new instances of this descriptor.If known the Type of the implementation.booleanReturns true if this cache has been setMethods inherited from class org.glassfish.hk2.utilities.AbstractActiveDescriptor
addContractType, addQualifierAnnotation, dispose, equals, getContractTypes, getFactoryLocatorId, getFactoryServiceId, getInjectees, getQualifierAnnotations, getScopeAnnotation, getScopeAsAnnotation, hashCode, isReified, releaseCache, removeContractType, removeQualifierAnnotation, setCache, setFactoryId, setImplementationType, setName, setReified, setScopeAnnotation, setScopeAsAnnotationMethods inherited from class org.glassfish.hk2.utilities.DescriptorImpl
addAdvertisedContract, addMetadata, addMetadata, addQualifier, clearMetadata, descriptorEquals, getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, 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, writeObjectMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.glassfish.hk2.api.Descriptor
getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, setRanking
-
Constructor Details
-
ConstantActiveDescriptor
public ConstantActiveDescriptor()For serializable -
ConstantActiveDescriptor
public ConstantActiveDescriptor(T theOne, Set<Type> advertisedContracts, Class<? extends Annotation> scope, String name, Set<Annotation> qualifiers, DescriptorVisibility descriptorVisibility, Boolean proxy, Boolean proxyForSameScope, String classAnalysisName, Map<String, List<String>> metadata, int rank) Creates the constant descriptor- Parameters:
theOne- May not be nulladvertisedContracts-scope-name-qualifiers-descriptorVisibility-proxy-proxyForSameScope-classAnalysisName-metadata-rank-
-
-
Method Details
-
getImplementation
Description copied from interface:DescriptorReturns the fully qualified class name of the implementation class. If this is a factory descriptor then this will return the fully qualified name of the class implementing the factory interface.- Specified by:
getImplementationin interfaceDescriptor- Overrides:
getImplementationin classDescriptorImpl- Returns:
- Might return null in some cases, but will usually return the fully qualified class name of the implementation class or of the factory class for this descriptor
-
getCache
Description copied from interface:SingleCacheThis can be used for scopes that will only every be created once. The returned value must have been set previously with setCache. If this is called when isCacheSet is false will result in a RuntimeException- Specified by:
getCachein interfaceSingleCache<T>- Overrides:
getCachein classAbstractActiveDescriptor<T>- Returns:
- A value cached with this ActiveDescriptor
-
isCacheSet
public boolean isCacheSet()Description copied from interface:SingleCacheReturns true if this cache has been set- Specified by:
isCacheSetin interfaceSingleCache<T>- Overrides:
isCacheSetin classAbstractActiveDescriptor<T>- Returns:
- true if there is a currently cached value, false otherwise
-
getImplementationClass
Description copied from interface:ActiveDescriptorThe 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
Description copied from interface:ActiveDescriptorIf known the Type of the implementation. If unknown will return the same asActiveDescriptor.getImplementationClass()- Returns:
- The type of the implementation or the implementation class
-
create
Description copied from interface:ActiveDescriptorCreates 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
-