All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mictaege.jitter.plugin.OnlyIfConstructorProcessor Maven / Gradle / Ivy

Go to download

The jitter-plugin is a Gradle plugin to build and distribute different flavours of an application from a single source base.

There is a newer version: 2023.3
Show newest version
package com.github.mictaege.jitter.plugin;

import com.github.mictaege.jitter.api.OnlyIf;
import spoon.processing.AbstractAnnotationProcessor;
import spoon.reflect.declaration.CtConstructor;

import java.util.List;

import static java.lang.System.out;
import static java.util.Arrays.asList;

public class OnlyIfConstructorProcessor extends AbstractAnnotationProcessor> {

    @Override
    public void process(final OnlyIf annotation, final CtConstructor constructor) {
        final List flavours = asList(annotation.value());
        if (flavours.stream().noneMatch(FlavourUtil::active)) {
            out.println("[jitter] Remove constructor " + constructor.getDeclaringType().getSimpleName());
            constructor.delete();
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy