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

com.iwillfailyou.inspections.allpublic.nonpublics.JavaNonpublic Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
package com.iwillfailyou.inspections.allpublic.nonpublics;

import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.TypeDeclaration;
import com.iwillfailyou.javaparser.Item;
import com.iwillfailyou.javaparser.NodeDescription;
import com.iwillfailyou.javaparser.NodeItem;

import java.util.Optional;

public final class JavaNonpublic implements Nonpublic {

    private final Item item;

    public JavaNonpublic(
        final MethodDeclaration expr,
        final TypeDeclaration root
    ) {
        this(
            new NodeItem(
                expr,
                new NodeDescription(expr.getName(), Optional.empty(), root)
            )
        );
    }

    public JavaNonpublic(
        final MethodDeclaration expr,
        final Modifier cause,
        final TypeDeclaration root
    ) {
        this(new NodeItem(expr, new NodeDescription(expr, cause, root)));
    }

    public JavaNonpublic(final Item item) {
        this.item = item;
    }

    @Override
    public String description() {
        return item.description();
    }

    @Override
    public boolean isSuppressed() {
        return item.isSuppressed("allpublic");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy