mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
Refactor kotlin querybean generator ProcessingContext extract asElement() method
This commit is contained in:
1 parent
53aacabce7
commit
74d907bbce
1 file changed
+9
-8
+9
-8
@@ -321,19 +321,13 @@ class ProcessingContext implements Constants {
|
|||||||
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
|
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
|
||||||
if (typeArguments.size() == 1) {
|
if (typeArguments.size() == 1) {
|
||||||
TypeMirror argType = typeArguments.get(0);
|
TypeMirror argType = typeArguments.get(0);
|
||||||
if (argType.getKind() == TypeKind.WILDCARD) {
|
Element argElement = asElement(argType);
|
||||||
argType = ((WildcardType) argType).getExtendsBound();
|
|
||||||
}
|
|
||||||
Element argElement = typeUtils.asElement(argType);
|
|
||||||
if (isEntityOrEmbedded(argElement)) {
|
if (isEntityOrEmbedded(argElement)) {
|
||||||
return createPropertyTypeAssoc(typeDef(argElement.asType()));
|
return createPropertyTypeAssoc(typeDef(argElement.asType()));
|
||||||
}
|
}
|
||||||
} else if (typeArguments.size() == 2) {
|
} else if (typeArguments.size() == 2) {
|
||||||
TypeMirror argType = typeArguments.get(1);
|
TypeMirror argType = typeArguments.get(1);
|
||||||
if (argType.getKind() == TypeKind.WILDCARD) {
|
Element argElement = asElement(argType);
|
||||||
argType = ((WildcardType) argType).getExtendsBound();
|
|
||||||
}
|
|
||||||
Element argElement = typeUtils.asElement(argType);
|
|
||||||
if (isEntityOrEmbedded(argElement)) {
|
if (isEntityOrEmbedded(argElement)) {
|
||||||
return createPropertyTypeAssoc(typeDef(argElement.asType()));
|
return createPropertyTypeAssoc(typeDef(argElement.asType()));
|
||||||
}
|
}
|
||||||
@@ -347,6 +341,13 @@ class ProcessingContext implements Constants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Element asElement(TypeMirror argType) {
|
||||||
|
if (argType.getKind() == TypeKind.WILDCARD) {
|
||||||
|
argType = ((WildcardType) argType).getExtendsBound();
|
||||||
|
}
|
||||||
|
return typeUtils.asElement(argType);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean typeInstanceOf(final TypeMirror typeMirror, final CharSequence desiredInterface) {
|
private boolean typeInstanceOf(final TypeMirror typeMirror, final CharSequence desiredInterface) {
|
||||||
TypeElement typeElement = (TypeElement) typeUtils.asElement(typeMirror);
|
TypeElement typeElement = (TypeElement) typeUtils.asElement(typeMirror);
|
||||||
if (typeElement == null || typeElement.getQualifiedName().contentEquals("java.lang.Object")) {
|
if (typeElement == null || typeElement.getQualifiedName().contentEquals("java.lang.Object")) {
|
||||||
|
|||||||
Reference in new issue
Block a user