@Contract public interface NoInstancesFilter
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.
| Modifier and Type | Interface and Description |
|---|---|
static class |
NoInstancesFilter.DefaultFilter
Matches abstract classes and classes with no public constructors.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
enableNoInstancesFilter(ServiceLocator locator)
Enables the default
NoInstancesFilter. |
boolean |
matches(Class<?> clazz)
Returns
true if the specified class does not provide instances of
itself through automatic invocation of a constructor. |
boolean matches(Class<?> clazz)
true if the specified class does not provide instances of
itself through automatic invocation of a constructor.static void enableNoInstancesFilter(ServiceLocator locator)
NoInstancesFilter.
This method replaces the default DynamicConfigurationService of
the service locator. Therefore, this method must be invoked prior to any
other configuration that relies on the NoInstancesFilter being
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
uncommitted DynamicConfiguration for the service locator.
This method is idempotent.
Copyright © 2009–2020 Oracle Corporation. All rights reserved.