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

com.g2forge.alexandria.java.reflect.JavaModifier Maven / Gradle / Ivy

There is a newer version: 0.0.18
Show newest version
package com.g2forge.alexandria.java.reflect;

import java.lang.reflect.Member;
import java.lang.reflect.Modifier;
import java.util.EnumSet;
import java.util.Set;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public enum JavaModifier {
	Public(Modifier.PUBLIC),
	Private(Modifier.PRIVATE),
	Protected(Modifier.PROTECTED),
	Static(Modifier.STATIC),
	Final(Modifier.FINAL),
	Synchronized(Modifier.SYNCHRONIZED),
	Volatile(Modifier.VOLATILE),
	Transient(Modifier.TRANSIENT),
	Native(Modifier.NATIVE),
	Interface(Modifier.INTERFACE),
	Abstract(Modifier.ABSTRACT),
	Strict(Modifier.STRICT);

	public static Set of(Member member) {
		final EnumSet retVal = EnumSet.noneOf(JavaModifier.class);
		final int modifiers = member.getModifiers();
		for (JavaModifier modifier : values()) {
			if ((modifier.modifier & modifiers) != 0) retVal.add(modifier);
		}
		return retVal;
	}

	protected final int modifier;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy