Package org.glassfish.hk2.utilities
Class ClassLoaderPostProcessor
- java.lang.Object
-
- org.glassfish.hk2.utilities.ClassLoaderPostProcessor
-
- All Implemented Interfaces:
PopulatorPostProcessor
public class ClassLoaderPostProcessor extends Object implements PopulatorPostProcessor
This is aPopulatorPostProcessor
that adds anHK2Loader
based on a ClassLoader. This is useful for those writing ClassLoader based plugins that need to ensure their descriptors are loaded with the given ClassLoader- Author:
- jwells
-
-
Constructor Summary
Constructors Constructor Description ClassLoaderPostProcessor(ClassLoader classloader)
Creates aPopulatorPostProcessor
that will set the HK2Loader of descriptors added withPopulator.populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)
.ClassLoaderPostProcessor(ClassLoader classloader, boolean force)
Creates aPopulatorPostProcessor
that will set the HK2Loader of descriptors added withPopulator.populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DescriptorImpl
process(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl)
This method can be used to alter the descriptor read in.
-
-
-
Constructor Detail
-
ClassLoaderPostProcessor
public ClassLoaderPostProcessor(ClassLoader classloader, boolean force)
Creates aPopulatorPostProcessor
that will set the HK2Loader of descriptors added withPopulator.populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)
- Parameters:
classloader
- The classloader to use when classloading the added servicesforce
- If true then this will overwrite any value in the descriptor. If false then if the descriptor will only be changed if the HK2Loader field of the descriptor is not already set
-
ClassLoaderPostProcessor
public ClassLoaderPostProcessor(ClassLoader classloader)
Creates aPopulatorPostProcessor
that will set the HK2Loader of descriptors added withPopulator.populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)
. The HK2Loader field of services will only be changed if they have not already been set- Parameters:
classloader
- The classloader to use when classloading the added services
-
-
Method Detail
-
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
-
-