java.lang.Object
org.glassfish.hk2.utilities.DuplicatePostProcessor
- All Implemented Interfaces:
PopulatorPostProcessor
This post-processor removes duplicate descriptors from the
set of descriptors being added to the service registry.
It is often the case when using a classpath that the same jar file can appear on the path more than once. For example this is often done when patching. However, if this jar contains HK2 descriptor files in it, that can mean duplicate services that are not intended to be duplicated. This service removes all duplicate descriptors from the set to be added to HK2
- Author:
- jwells
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a DuplicatePostProcessor with the STRICT mode for determining duplicatesCreates a DuplicatePostProcessor with the -
Method Summary
Modifier and TypeMethodDescriptiongetMode()Returns the mode of this DuplicatePostProcessorMode of this processorprocess(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl) This method can be used to alter the descriptor read in.toString()
-
Constructor Details
-
DuplicatePostProcessor
public DuplicatePostProcessor()Creates a DuplicatePostProcessor with the STRICT mode for determining duplicates -
DuplicatePostProcessor
Creates a DuplicatePostProcessor with the- Parameters:
mode-
-
-
Method Details
-
getMode
Returns the mode of this DuplicatePostProcessorMode of this processor- Returns:
- The mode
-
process
Description copied from interface:PopulatorPostProcessorThis method can be used to alter the descriptor read in. It can also add descriptors, or remove the descriptor (by returning null). Any alterations made to the descriptor passed in will remain in effect.- Specified by:
processin interfacePopulatorPostProcessor- Parameters:
serviceLocator- the ServiceLocator being populated. Will not be nulldescriptorImpl- The descriptorImpl read from some external source. This processor can modify this descriptor fully- Returns:
- The descriptor to be added to the system. If this returns null then the descriptorImpl passed in will NOT be added to the system. Implementations may return the descriptor passed in, but do not have to. The descriptor added to the system will be the one returned from this method
-
toString
-