public abstract class AbstractServiceProviderProcessor extends AbstractProcessor
META-INF/services/* and
META-INF/namedservices/* registrations from annotations. From version
8.40, it is not necessary (and is not recommended) to declareprocessingEnv| Modifier | Constructor and Description |
|---|---|
protected |
AbstractServiceProviderProcessor()
Throws IllegalStateException.
|
| Modifier and Type | Method and Description |
|---|---|
SourceVersion |
getSupportedSourceVersion()
If the subclass itself does not define SupportedSourceVersion, assume latest().
|
protected abstract boolean |
handleProcess(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv)
|
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
protected void |
register(Element el,
Class<? extends Annotation> annotation,
TypeMirror type,
String path,
int position,
String... supersedes)
Register a service.
|
protected void |
register(Element el,
String path) |
protected void |
register(TypeElement el,
Class<? extends Annotation> annotation,
TypeMirror type,
String path,
int position,
String[] supersedes)
Deprecated.
|
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, init, isInitializedprotected AbstractServiceProviderProcessor()
public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process in interface Processorprocess in class AbstractProcessorprotected abstract boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process(java.util.Set<? extends javax.lang.model.element.TypeElement>, javax.annotation.processing.RoundEnvironment).
Called during regular rounds if there are no outstanding errors.
In the last round, one of the processors will write out generated registrations.annotations - as in process(java.util.Set<? extends javax.lang.model.element.TypeElement>, javax.annotation.processing.RoundEnvironment)roundEnv - as in process(java.util.Set<? extends javax.lang.model.element.TypeElement>, javax.annotation.processing.RoundEnvironment)process(java.util.Set<? extends javax.lang.model.element.TypeElement>, javax.annotation.processing.RoundEnvironment)protected final void register(Element el, Class<? extends Annotation> annotation, TypeMirror type, String path, int position, String... supersedes)
clazz - the service implementation type (an error will be reported if not a TypeElement)annotation - the (top-level) annotation registering the service, for diagnostic purposestype - the type to which the implementation must be assignablepath - a path under which to register, or "" if inapplicableposition - a position at which to register, or Integer.MAX_VALUE to skipsupersedes - possibly empty list of implementation to supersede@Deprecated protected final void register(TypeElement el, Class<? extends Annotation> annotation, TypeMirror type, String path, int position, String[] supersedes)
public SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion in interface ProcessorgetSupportedSourceVersion in class AbstractProcessorCopyright © 2025 API Design. All Rights Reserved.