|
@@ -13,6 +13,7 @@ import net.ranides.assira.generic.LazyCaller;
|
|
|
import net.ranides.assira.generic.LazyCallers;
|
|
import net.ranides.assira.generic.LazyCallers;
|
|
|
import net.ranides.assira.generic.SerializationUtils;
|
|
import net.ranides.assira.generic.SerializationUtils;
|
|
|
import net.ranides.assira.reflection.*;
|
|
import net.ranides.assira.reflection.*;
|
|
|
|
|
+import net.ranides.assira.reflection.util.ReflectUtils;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.annotation.Annotation;
|
|
@@ -145,13 +146,14 @@ public class RClass<T> extends AClass<T> implements Serializable {
|
|
|
private CQuery<IMethod> getRMethods(AHints hints) {
|
|
private CQuery<IMethod> getRMethods(AHints hints) {
|
|
|
IContext c = context();
|
|
IContext c = context();
|
|
|
if(hints.isDeclaredHint()) {
|
|
if(hints.isDeclaredHint()) {
|
|
|
- return CQuery.from().array(type.getDeclaredMethods()).map(m -> FMethod.newMethod(true, c, m));
|
|
|
|
|
|
|
+ return CQuery.from().array(type.getDeclaredMethods()).filter(ReflectUtils::isAccessible).map(m -> FMethod.newMethod(true, c, m));
|
|
|
} else if(hints.isInheritedHint()) {
|
|
} else if(hints.isInheritedHint()) {
|
|
|
return CQuery.from()
|
|
return CQuery.from()
|
|
|
.iterable(() -> new RawAncestors(type)).flatArray(Class::getDeclaredMethods)
|
|
.iterable(() -> new RawAncestors(type)).flatArray(Class::getDeclaredMethods)
|
|
|
|
|
+ .filter(ReflectUtils::isAccessible)
|
|
|
.map(m -> FMethod.newMethod(isdecl(m), c, m));
|
|
.map(m -> FMethod.newMethod(isdecl(m), c, m));
|
|
|
} else {
|
|
} else {
|
|
|
- return CQuery.from().array(type.getMethods()).map(m -> FMethod.newMethod(isdecl(m), c, m));
|
|
|
|
|
|
|
+ return CQuery.from().array(type.getMethods()).filter(ReflectUtils::isAccessible).map(m -> FMethod.newMethod(isdecl(m), c, m));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -162,9 +164,9 @@ public class RClass<T> extends AClass<T> implements Serializable {
|
|
|
private CQuery getRConstructors(AHints hints) {
|
|
private CQuery getRConstructors(AHints hints) {
|
|
|
IContext c = context();
|
|
IContext c = context();
|
|
|
if(hints.isInheritedHint() || hints.isDeclaredHint()) {
|
|
if(hints.isInheritedHint() || hints.isDeclaredHint()) {
|
|
|
- return CQuery.from().array(type.getDeclaredConstructors()).map(m -> FMethod.newConstructor(c,m));
|
|
|
|
|
|
|
+ return CQuery.from().array(type.getDeclaredConstructors()).filter(ReflectUtils::isAccessible).map(m -> FMethod.newConstructor(c,m));
|
|
|
} else {
|
|
} else {
|
|
|
- return CQuery.from().array(type.getConstructors()).map(m -> FMethod.newConstructor(c,m));
|
|
|
|
|
|
|
+ return CQuery.from().array(type.getConstructors()).filter(ReflectUtils::isAccessible).map(m -> FMethod.newConstructor(c,m));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -215,14 +217,17 @@ public class RClass<T> extends AClass<T> implements Serializable {
|
|
|
if(hints.isDeclaredHint()) {
|
|
if(hints.isDeclaredHint()) {
|
|
|
return CQuery.from()
|
|
return CQuery.from()
|
|
|
.array(type.getDeclaredFields())
|
|
.array(type.getDeclaredFields())
|
|
|
|
|
+ .filter(ReflectUtils::isAccessible)
|
|
|
.map(f -> FField.newField(true, c, f));
|
|
.map(f -> FField.newField(true, c, f));
|
|
|
} else if(hints.isInheritedHint()) {
|
|
} else if(hints.isInheritedHint()) {
|
|
|
return CQuery.from()
|
|
return CQuery.from()
|
|
|
.iterable(() -> new RawAncestors(type)).flatArray(Class::getDeclaredFields)
|
|
.iterable(() -> new RawAncestors(type)).flatArray(Class::getDeclaredFields)
|
|
|
|
|
+ .filter(ReflectUtils::isAccessible)
|
|
|
.map(f -> FField.newField(isdecl(f), c, f));
|
|
.map(f -> FField.newField(isdecl(f), c, f));
|
|
|
} else {
|
|
} else {
|
|
|
return CQuery.from()
|
|
return CQuery.from()
|
|
|
.array(type.getFields())
|
|
.array(type.getFields())
|
|
|
|
|
+ .filter(ReflectUtils::isAccessible)
|
|
|
.map(f -> FField.newField(isdecl(f), c, f));
|
|
.map(f -> FField.newField(isdecl(f), c, f));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|