Package org.glassfish.hk2.utilities
Class DuplicatePostProcessor
java.lang.Object
org.glassfish.hk2.utilities.DuplicatePostProcessor
- All Implemented Interfaces:
PopulatorPostProcessor
- Direct Known Subclasses:
ContextDuplicatePostProcessor
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Key use for implementation only (along with descriptor type, otherwise factories eliminate themselves) -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashSet
<DuplicatePostProcessor.ImplOnlyKey> private final DuplicatePostProcessorMode
private final HashSet
<DescriptorImpl> -
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 processorprivate DescriptorImpl
implementationOnly
(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl) process
(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl) This method can be used to alter the descriptor read in.private DescriptorImpl
strict
(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl) toString()
-
Field Details
-
mode
-
strictDupSet
-
implOnlyDupSet
-
-
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: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
-
implementationOnly
private DescriptorImpl implementationOnly(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl) -
strict
-
toString
-