com.github.mictaege.jitter.plugin.OnlyIfClassProcessor Maven / Gradle / Ivy
package com.github.mictaege.jitter.plugin;
import static com.github.mictaege.jitter.plugin.JitterUtil.log;
import static java.util.Arrays.asList;
import java.util.List;
import com.github.mictaege.jitter.api.OnlyIf;
import spoon.processing.AbstractAnnotationProcessor;
import spoon.reflect.declaration.CtType;
public class OnlyIfClassProcessor extends AbstractAnnotationProcessor> {
@Override
public void process(final OnlyIf annotation, final CtType> clazz) {
final List flavours = asList(annotation.value());
if (flavours.stream().noneMatch(JitterUtil::active)) {
log().info("Remove class " + clazz.getSimpleName());
clazz.delete();
}
}
}