com.google.auto.service.processor
Class AutoServiceProcessor

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by com.google.auto.service.processor.AutoServiceProcessor
All Implemented Interfaces:
Processor

@SupportedOptions(value={"debug","verify"})
public class AutoServiceProcessor
extends AbstractProcessor

Processes AutoService annotations and generates the service provider configuration files described in ServiceLoader.

Processor Options:


Field Summary
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
AutoServiceProcessor()
           
 
Method Summary
 com.google.common.collect.ImmutableSet<String> getSupportedAnnotationTypes()
           
 SourceVersion getSupportedSourceVersion()
           
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
           For each class annotated with AutoService Verify the AutoService interface value is correct Categorize the class by its service interface For each AutoService interface Create a file named META-INF/services/<interface> For each AutoService annotated class for this interface Create an entry in the file
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedOptions, init, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoServiceProcessor

public AutoServiceProcessor()
Method Detail

getSupportedAnnotationTypes

public com.google.common.collect.ImmutableSet<String> getSupportedAnnotationTypes()
Specified by:
getSupportedAnnotationTypes in interface Processor
Overrides:
getSupportedAnnotationTypes in class AbstractProcessor

getSupportedSourceVersion

public SourceVersion getSupportedSourceVersion()
Specified by:
getSupportedSourceVersion in interface Processor
Overrides:
getSupportedSourceVersion in class AbstractProcessor

process

public boolean process(Set<? extends TypeElement> annotations,
                       RoundEnvironment roundEnv)
  1. For each class annotated with AutoService
    • Verify the AutoService interface value is correct
    • Categorize the class by its service interface
  2. For each AutoService interface
    • Create a file named META-INF/services/<interface>
    • For each AutoService annotated class for this interface
      • Create an entry in the file

Specified by:
process in interface Processor
Specified by:
process in class AbstractProcessor


Copyright © 2014 Google, Inc.. All rights reserved.