Package org.glassfish.hk2.utilities
Class DuplicatePostProcessor
- java.lang.Object
-
- org.glassfish.hk2.utilities.DuplicatePostProcessor
-
- All Implemented Interfaces:
PopulatorPostProcessor
- Direct Known Subclasses:
ContextDuplicatePostProcessor
@PerLookup public class DuplicatePostProcessor extends Object implements 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
Constructors Constructor Description DuplicatePostProcessor()
Creates a DuplicatePostProcessor with the STRICT mode for determining duplicatesDuplicatePostProcessor(DuplicatePostProcessorMode mode)
Creates a DuplicatePostProcessor with the
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DuplicatePostProcessorMode
getMode()
Returns the mode of this DuplicatePostProcessorMode of this processorDescriptorImpl
process(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl)
This method can be used to alter the descriptor read in.String
toString()
-
-
-
Constructor Detail
-
DuplicatePostProcessor
public DuplicatePostProcessor()
Creates a DuplicatePostProcessor with the STRICT mode for determining duplicates
-
DuplicatePostProcessor
public DuplicatePostProcessor(DuplicatePostProcessorMode mode)
Creates a DuplicatePostProcessor with the- Parameters:
mode
-
-
-
Method Detail
-
getMode
public DuplicatePostProcessorMode getMode()
Returns the mode of this DuplicatePostProcessorMode of this processor- Returns:
- The mode
-
process
public DescriptorImpl process(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl)
Description copied from interface:PopulatorPostProcessor
This 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:
process
in 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
-
-