|
|
@@ -11,7 +11,7 @@ import java.lang.reflect.Field;
|
|
|
import java.lang.reflect.Modifier;
|
|
|
import java.lang.reflect.Parameter;
|
|
|
import java.util.Set;
|
|
|
-import net.ranides.assira.generic.BitMaskFactory;
|
|
|
+import net.ranides.assira.collection.sets.Bitmask;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -71,7 +71,7 @@ public enum IAttribute {
|
|
|
|
|
|
private static final int ACCESS_ANY = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
|
|
|
|
|
|
- private static final BitMaskFactory<IAttribute> MAP = new BitMaskFactory<>(IAttribute.values(), a -> a.mask);
|
|
|
+ private static final Bitmask<IAttribute> MAP = new Bitmask<>(IAttribute.values(), a -> a.mask);
|
|
|
|
|
|
private final int mask;
|
|
|
|
|
|
@@ -79,23 +79,23 @@ public enum IAttribute {
|
|
|
this.mask = mask;
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> constantOf(IAttribute... attrs) {
|
|
|
- return MAP.constantOf(attrs);
|
|
|
+ public static Set<IAttribute> constant(IAttribute... attrs) {
|
|
|
+ return MAP.constant(attrs);
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> valueOf(IAttribute... attrs) {
|
|
|
- return MAP.valueOf(attrs);
|
|
|
+ public static Set<IAttribute> collect(IAttribute... attrs) {
|
|
|
+ return MAP.collect(attrs);
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> valueOf(Field field) {
|
|
|
+ public static Set<IAttribute> resolve(Field field) {
|
|
|
int mask = getModifiers(field.getModifiers());
|
|
|
if(!(field.getGenericType() instanceof Class)) {
|
|
|
mask |= PARAMETERIZED.mask;
|
|
|
}
|
|
|
- return MAP.valueOf(mask);
|
|
|
+ return MAP.collect(mask);
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> valueOf(Executable method) {
|
|
|
+ public static Set<IAttribute> resolve(Executable method) {
|
|
|
int mask = getModifiers(method.getModifiers());
|
|
|
if( 0 != ((M_BRIDGE|M_VARARGS) & mask) ) {
|
|
|
mask |= (0 != (mask & M_BRIDGE)) ? BRIDGE.mask : 0;
|
|
|
@@ -105,34 +105,31 @@ public enum IAttribute {
|
|
|
if( 0 != method.getTypeParameters().length ) {
|
|
|
mask |= PARAMETERIZED.mask;
|
|
|
}
|
|
|
- return MAP.valueOf(mask);
|
|
|
+ return MAP.collect(mask);
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> valueOf(Parameter param) {
|
|
|
+ public static Set<IAttribute> resolve(Parameter param) {
|
|
|
int mask = getModifiers(param.getModifiers());
|
|
|
if(!(param.getParameterizedType() instanceof Class)) {
|
|
|
mask |= PARAMETERIZED.mask;
|
|
|
}
|
|
|
- return MAP.valueOf(mask);
|
|
|
+ return MAP.collect(mask);
|
|
|
}
|
|
|
|
|
|
- private static int getModifiers(int mask) {
|
|
|
- mask |= DECLARED.mask;
|
|
|
- if( 0 == (mask & ACCESS_ANY)) {
|
|
|
- mask |= PACKAGE.mask;
|
|
|
+ public static Set<IAttribute> resolve(Class<?> type) {
|
|
|
+ int mask = getModifiers(type.getModifiers());
|
|
|
+ if( 0 != type.getTypeParameters().length) {
|
|
|
+ mask |= PARAMETERIZED.mask;
|
|
|
}
|
|
|
- return mask;
|
|
|
+ return MAP.collect(mask);
|
|
|
}
|
|
|
|
|
|
- public static Set<IAttribute> valueOf(Class<?> type) {
|
|
|
- int mask = DECLARED.mask | type.getModifiers();
|
|
|
+ private static int getModifiers(int mask) {
|
|
|
+ mask |= DECLARED.mask;
|
|
|
if( 0 == (mask & ACCESS_ANY)) {
|
|
|
mask |= PACKAGE.mask;
|
|
|
}
|
|
|
- if( 0 != type.getTypeParameters().length) {
|
|
|
- mask |= PARAMETERIZED.mask;
|
|
|
- }
|
|
|
- return MAP.valueOf(mask);
|
|
|
+ return mask;
|
|
|
}
|
|
|
|
|
|
}
|