Interface NoInstancesFilter
- All Known Implementing Classes:
NoInstancesFilter.DefaultFilter
Use enableNoInstancesFilter(ServiceLocator) to enable the
default filter, which matches abstract classes and
classes with no public constructors.
When this filter matches a class, it is implied that the ActiveDescriptor for the class must disallow the creation of instances and must
advertise no contracts.
This class may be useful in combination with ProvidesListener, for
example, to permit registration of classes that do not provide themselves as
a service but that provide other services by way of static members annotated
with Provides.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classMatches abstract classes and classes with no public constructors. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidenableNoInstancesFilter(org.glassfish.hk2.api.ServiceLocator locator) Enables the defaultNoInstancesFilter.booleanReturnstrueif the specified class does not provide instances of itself through automatic invocation of a constructor.
-
Method Details
-
matches
Returnstrueif the specified class does not provide instances of itself through automatic invocation of a constructor. -
enableNoInstancesFilter
static void enableNoInstancesFilter(org.glassfish.hk2.api.ServiceLocator locator) Enables the defaultNoInstancesFilter.This method replaces the default
DynamicConfigurationServiceof the service locator. Therefore, this method must be invoked prior to any other configuration that relies on theNoInstancesFilterbeing applied. In other words, the filter will not be applied to classes that were already added to the service locator or that were already added to an uncommittedDynamicConfigurationfor the service locator.This method is idempotent.
-