smoothy.compiler.Processor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smoothy-compiler Show documentation
Show all versions of smoothy-compiler Show documentation
Field and method binding for Android views.
package smoothy.compiler;
import com.google.auto.service.AutoService;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import smoothy.BindExtra;
@AutoService(javax.annotation.processing.Processor.class)
@SupportedSourceVersion(SourceVersion.RELEASE_7)
public class Processor extends AbstractProcessor{
private ProcessingEnvironment mProcessingEnvironment;
private Elements mElementsUtils;
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
mProcessingEnvironment = processingEnv;
mElementsUtils = processingEnv.getElementUtils();
}
@Override
public Set getSupportedAnnotationTypes() {
Set supportedSet = new HashSet<>();
supportedSet.add(BindExtra.class.getCanonicalName());
return supportedSet;
}
@Override
public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
new SmoothyExtraProcessor(mElementsUtils).process(roundEnv, mProcessingEnvironment);
return false;
}
}