[#1820] Cannot fetch into non-public POJO classes. Their members /
getters / setters should be made accessible
This commit is contained in:
parent
1ae5227d9d
commit
83f5bf8388
@ -43,6 +43,7 @@ import static org.jooq.impl.Factory.getDataType;
|
||||
import static org.jooq.impl.Factory.nullSafe;
|
||||
import static org.jooq.impl.Factory.val;
|
||||
import static org.jooq.tools.StringUtils.leftPad;
|
||||
import static org.jooq.tools.reflect.Reflect.accessible;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -789,7 +790,7 @@ final class Util {
|
||||
|
||||
if (annotation != null) {
|
||||
if (name.equals(annotation.name())) {
|
||||
result.add(member);
|
||||
result.add(accessible(member));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -805,10 +806,10 @@ final class Util {
|
||||
|
||||
for (java.lang.reflect.Field member : getInstanceMembers(type)) {
|
||||
if (name.equals(member.getName())) {
|
||||
result.add(member);
|
||||
result.add(accessible(member));
|
||||
}
|
||||
else if (StringUtils.toCamelCaseLC(name).equals(member.getName())) {
|
||||
result.add(member);
|
||||
result.add(accessible(member));
|
||||
}
|
||||
}
|
||||
|
||||
@ -828,7 +829,7 @@ final class Util {
|
||||
|
||||
// Annotated setter
|
||||
if (method.getParameterTypes().length == 1) {
|
||||
result.add(method);
|
||||
result.add(accessible(method));
|
||||
}
|
||||
|
||||
// Annotated getter with matching setter
|
||||
@ -841,7 +842,7 @@ final class Util {
|
||||
|
||||
// Setter annotation is more relevant
|
||||
if (setter.getAnnotation(Column.class) == null) {
|
||||
result.add(setter);
|
||||
result.add(accessible(setter));
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException ignore) {}
|
||||
@ -864,7 +865,7 @@ final class Util {
|
||||
|
||||
// Annotated getter
|
||||
if (method.getParameterTypes().length == 0) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
|
||||
// Annotated setter with matching getter
|
||||
@ -877,7 +878,7 @@ final class Util {
|
||||
|
||||
// Getter annotation is more relevant
|
||||
if (getter.getAnnotation(Column.class) == null) {
|
||||
return getter;
|
||||
return accessible(getter);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException ignore) {}
|
||||
@ -887,7 +888,7 @@ final class Util {
|
||||
|
||||
// Getter annotation is more relevant
|
||||
if (getter.getAnnotation(Column.class) == null) {
|
||||
return getter;
|
||||
return accessible(getter);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException ignore) {}
|
||||
@ -908,16 +909,16 @@ final class Util {
|
||||
for (Method method : getInstanceMethods(type)) {
|
||||
if (method.getParameterTypes().length == 1) {
|
||||
if (name.equals(method.getName())) {
|
||||
result.add(method);
|
||||
result.add(accessible(method));
|
||||
}
|
||||
else if (StringUtils.toCamelCaseLC(name).equals(method.getName())) {
|
||||
result.add(method);
|
||||
result.add(accessible(method));
|
||||
}
|
||||
else if (("set" + name).equals(method.getName())) {
|
||||
result.add(method);
|
||||
result.add(accessible(method));
|
||||
}
|
||||
else if (("set" + StringUtils.toCamelCase(name)).equals(method.getName())) {
|
||||
result.add(method);
|
||||
result.add(accessible(method));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,22 +934,22 @@ final class Util {
|
||||
for (Method method : getInstanceMethods(type)) {
|
||||
if (method.getParameterTypes().length == 0) {
|
||||
if (name.equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
else if (StringUtils.toCamelCaseLC(name).equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
else if (("get" + name).equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
else if (("get" + StringUtils.toCamelCase(name)).equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
else if (("is" + name).equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
else if (("is" + StringUtils.toCamelCase(name)).equals(method.getName())) {
|
||||
return method;
|
||||
return accessible(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user