Top Description Fields Constructors Methods
org.glassfish.hk2.utilities

public Class ClassLoaderPostProcessor

extends Object
implements PopulatorPostProcessor
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.PopulatorPostProcessor
Imports
org.glassfish.hk2.api.HK2Loader, .PopulatorPostProcessor, .ServiceLocator

This is a PopulatorPostProcessor that adds an HK2Loader 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

Field Summary

Modifier and TypeField and Description
private final boolean
private final HK2Loader

Constructor Summary

AccessConstructor and Description
public
ClassLoaderPostProcessor(ClassLoader
The classloader to use when classloading the added services
classloader
,
boolean
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
force
)

Creates a PopulatorPostProcessor that will set the HK2Loader of descriptors added with org.glassfish.hk2.api.Populator#populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)

public
ClassLoaderPostProcessor(final ClassLoader
The classloader to use when classloading the added services
classloader
)

Creates a PopulatorPostProcessor that will set the HK2Loader of descriptors added with org.glassfish.hk2.api.Populator#populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...).

Method Summary

Modifier and TypeMethod and Description
public DescriptorImpl
process(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl)

Implements org.glassfish.hk2.api.PopulatorPostProcessor.process.

This method can be used to alter the descriptor read in. It can also add descriptors, or remove the descriptor (by returning null).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

forceback to summary
private final boolean force
loaderback to summary
private final HK2Loader loader

Constructor Detail

ClassLoaderPostProcessorback to summary
public ClassLoaderPostProcessor(ClassLoader classloader, boolean force)

Creates a PopulatorPostProcessor that will set the HK2Loader of descriptors added with org.glassfish.hk2.api.Populator#populate(org.glassfish.hk2.api.DescriptorFileFinder, PopulatorPostProcessor...)

Parameters
classloader:ClassLoader

The classloader to use when classloading the added services

force:boolean

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

ClassLoaderPostProcessorback to summary
public ClassLoaderPostProcessor(final ClassLoader classloader)

Creates a PopulatorPostProcessor that will set the HK2Loader of descriptors added with org.glassfish.hk2.api.Populator#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:ClassLoader

The classloader to use when classloading the added services

Method Detail

processback to summary
public DescriptorImpl process(ServiceLocator serviceLocator, DescriptorImpl descriptorImpl)

Implements org.glassfish.hk2.api.PopulatorPostProcessor.process.

Doc from org.glassfish.hk2.api.PopulatorPostProcessor.process.

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.

Annotations
@Override