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

fr.vergne.pester.options.Visibility Maven / Gradle / Ivy

The newest version!
package fr.vergne.pester.options;

import java.lang.reflect.Modifier;
import java.util.function.Predicate;

public enum Visibility implements Option {
	PUBLIC(Modifier::isPublic),
	PROTECTED(Modifier::isProtected),
	PACKAGE(mod -> !Modifier.isPublic(mod) && !Modifier.isProtected(mod) && !Modifier.isPrivate(mod)),
	PRIVATE(Modifier::isPrivate);
	
	private final Predicate modifierPredicate;
	
	private Visibility(Predicate modifierPredicate) {
		this.modifierPredicate = modifierPredicate;
	}
	
	@Override
	public boolean testModifiers(int modifiers) {
		return modifierPredicate.test(modifiers);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy