io.vertx.codegen.type.ClassKind Java Examples
The following examples show how to use
io.vertx.codegen.type.ClassKind.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassNullableTest.java From vertx-codegen with Apache License 2.0 | 6 votes |
@Test public void testMethodWithOverloadedNullableParam() throws Exception { generateClass(model -> { List<MethodInfo> methods = model.getMethods(); assertEquals(2, methods.size()); MethodInfo mi1 = methods.get(0); checkMethod(mi1, "method", 2, "void", MethodKind.OTHER); assertEquals(ClassKind.STRING, mi1.getParams().get(0).getType().getKind()); checkParam(mi1.getParams().get(0), "s", String.class); assertTrue(mi1.getParams().get(0).isNullable()); checkParam(mi1.getParams().get(1), "i", Integer.class); assertFalse(mi1.getParams().get(1).isNullable()); MethodInfo mi2 = methods.get(1); checkMethod(mi2, "method", 2, "void", MethodKind.OTHER); checkParam(mi2.getParams().get(0), "i", Integer.class); assertFalse(mi2.getParams().get(0).isNullable()); checkParam(mi2.getParams().get(1), "s", String.class); assertTrue(mi2.getParams().get(1).isNullable()); }, MethodWithOverloadedNullableParam.class); }
Example #2
Source File: RxJava2Generator.java From vertx-rx with Apache License 2.0 | 6 votes |
private void genToXXXEr(TypeInfo streamType, String rxType, String rxName, PrintWriter writer) { writer.format(" public synchronized WriteStream%s<%s> to%s() {%n", rxType, genTranslatedTypeName(streamType), rxType); writer.format(" if (%s == null) {%n", rxName); if (streamType.getKind() == ClassKind.API) { writer.format(" Function<%s, %s> conv = %s::getDelegate;%n", genTranslatedTypeName(streamType.getRaw()), streamType.getName(), genTranslatedTypeName(streamType)); writer.format(" %s = RxHelper.to%s(getDelegate(), conv);%n", rxName, rxType); } else if (streamType.isVariable()) { String typeVar = streamType.getSimpleName(); writer.format(" Function<%s, %s> conv = (Function<%s, %s>) __typeArg_0.unwrap;%n", typeVar, typeVar, typeVar, typeVar); writer.format(" %s = RxHelper.to%s(getDelegate(), conv);%n", rxName, rxType); } else { writer.format(" %s = RxHelper.to%s(getDelegate());%n", rxName, rxType); } writer.println(" }"); writer.format(" return %s;%n", rxName); writer.println(" }"); writer.println(); }
Example #3
Source File: Helper.java From vertx-codegen with Apache License 2.0 | 6 votes |
public static ClassKind getAnnotatedDataObjectDeserialisationType(Elements elementUtils, Types typeUtils, TypeElement dataObjectElt) { if (isConcreteClass(dataObjectElt)) { Set<String> types = elementUtils .getAllMembers(dataObjectElt) .stream() .filter(e -> e.getKind() == ElementKind.CONSTRUCTOR) .map(e -> (ExecutableElement) e) .filter(constructor -> constructor.getParameters().size() == 1 && constructor.getModifiers().contains(Modifier.PUBLIC) && dataObjectTypes.contains(constructor.getParameters().get(0).asType().toString())) .map(ctor -> ctor.getParameters().get(0).asType().toString()) .collect(Collectors.toSet()); // Order matter if (types.contains("io.vertx.core.json.JsonObject")) { return ClassKind.JSON_OBJECT; } else if (types.contains("java.lang.String")) { return ClassKind.STRING; } } return null; }
Example #4
Source File: Helper.java From vertx-codegen with Apache License 2.0 | 6 votes |
public static ClassKind getAnnotatedDataObjectAnnotatedSerializationType(Elements elementUtils, TypeElement dataObjectElt) { return elementUtils.getAllMembers(dataObjectElt) .stream() .flatMap(Helper.FILTER_METHOD) .filter(exeElt -> exeElt.getParameters().isEmpty() && exeElt.getSimpleName().toString().equals("toJson")) .flatMap(exeElt -> { ClassKind ck; switch (exeElt.getReturnType().toString()) { case "io.vertx.core.json.JsonObject": return Stream.of(ClassKind.JSON_OBJECT); case "java.lang.String": return Stream.of(ClassKind.STRING); } return Stream.empty(); }) .findFirst() .orElse(null); }
Example #5
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidHandlerType(TypeInfo type, boolean allowAnyJavaType) { if (type.getErased().getKind() == ClassKind.HANDLER) { TypeInfo eventType = ((ParameterizedTypeInfo) type).getArgs().get(0); if (isValidCallbackValueType(eventType, allowAnyJavaType)) { return true; } else if (eventType.getErased().getKind() == ClassKind.ASYNC_RESULT && !eventType.isNullable()) { TypeInfo resultType = ((ParameterizedTypeInfo) eventType).getArgs().get(0); if (isValidCallbackValueType(resultType, allowAnyJavaType)) { return true; } } } return false; }
Example #6
Source File: ProxyTest.java From vertx-service-proxy with Apache License 2.0 | 5 votes |
@Test public void testValidCloseWithFuture() throws Exception { ProxyModel model = generateProxyModel(ValidProxyCloseWithFuture.class); assertEquals(1, model.getMethods().size()); assertEquals(MethodKind.FUTURE, model.getMethods().get(0).getKind()); ParameterizedTypeInfo handlerType = (ParameterizedTypeInfo) model.getMethods().get(0).getParams().get(0).getType(); ParameterizedTypeInfo asyncResultType = (ParameterizedTypeInfo) handlerType.getArgs().get(0); assertEquals(ClassKind.VOID, asyncResultType.getArgs().get(0).getKind()); }
Example #7
Source File: ModuleModel.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isLegalJsonType(TypeMirror type) { ClassKind kind = ClassKind.getKind(type.toString(), type.getAnnotation(VertxGen.class) != null); return kind.json || type.toString().equals("java.lang.Boolean") || type.toString().equals("java.lang.Number") || kind == ClassKind.STRING; }
Example #8
Source File: DataObjectHelperGen.java From vertx-codegen with Apache License 2.0 | 5 votes |
private void genPropToJson(String before, String after, PropertyInfo prop, PrintWriter writer) { String jsonPropertyName = LowerCamelCase.INSTANCE.to(formatter, prop.getName()); String indent = " "; if (prop.isList() || prop.isSet()) { writer.print(indent + "if (obj." + prop.getGetterMethod() + "() != null) {\n"); writer.print(indent + " JsonArray array = new JsonArray();\n"); writer.print(indent + " obj." + prop.getGetterMethod() + "().forEach(item -> array.add(" + before + "item" + after + "));\n"); writer.print(indent + " json.put(\"" + jsonPropertyName + "\", array);\n"); writer.print(indent + "}\n"); } else if (prop.isMap()) { writer.print(indent + "if (obj." + prop.getGetterMethod() + "() != null) {\n"); writer.print(indent + " JsonObject map = new JsonObject();\n"); writer.print(indent + " obj." + prop.getGetterMethod() + "().forEach((key, value) -> map.put(key, " + before + "value" + after + "));\n"); writer.print(indent + " json.put(\"" + jsonPropertyName + "\", map);\n"); writer.print(indent + "}\n"); } else { String sp = ""; if (prop.getType().getKind() != ClassKind.PRIMITIVE) { sp = " "; writer.print(indent + "if (obj." + prop.getGetterMethod() + "() != null) {\n"); } writer.print(indent + sp + "json.put(\"" + jsonPropertyName + "\", " + before + "obj." + prop.getGetterMethod() + "()" + after + ");\n"); if (prop.getType().getKind() != ClassKind.PRIMITIVE) { writer.print(indent + "}\n"); } } }
Example #9
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 5 votes |
public TypeArgExpression resolveTypeArg(TypeVariableInfo typeVar) { for (TypeParamInfo.Method typeParam : typeParams) { if (typeParam.getName().equals(typeVar.getName())) { for (ParamInfo param : params) { if (param.getType().getKind() == ClassKind.CLASS_TYPE && param.getType().isParameterized()) { TypeInfo arg_ = ((ParameterizedTypeInfo) param.getType()).getArg(0); if (arg_.isVariable()) { TypeVariableInfo ttt = (TypeVariableInfo) arg_; if (ttt.getParam().equals(typeParam)) { return new TypeArgExpression(TypeArgExpression.CLASS_TYPE_ARG, ttt, param, 0); } } } else if (param.getType().getKind() == ClassKind.API && param.getType().isParameterized()) { ParameterizedTypeInfo type = (ParameterizedTypeInfo) param.getType(); int index = 0; for (TypeInfo i : type.getArgs()) { if (i instanceof TypeVariableInfo) { TypeVariableInfo tt = (TypeVariableInfo) i; if (tt.getParam().equals(typeParam)) { return new TypeArgExpression(TypeArgExpression.API_ARG, tt, param, index); } } index++; } } } return null; } } return null; }
Example #10
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean containsAnyJavaType(TypeInfo type) { if (type instanceof ParameterizedTypeInfo) { return containsAnyJavaType(type.getRaw()) || ((ParameterizedTypeInfo) type).getArgs().stream().anyMatch(MethodInfo::containsAnyJavaType); } else { return type.getKind() == ClassKind.OTHER; } }
Example #11
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 5 votes |
public MethodKind getKind() { int lastParamIndex = params.size() - 1; if (lastParamIndex >= 0 && (returnType.isVoid() || fluent)) { TypeInfo lastParamType = params.get(lastParamIndex).type; if (lastParamType.getKind() == ClassKind.HANDLER) { TypeInfo typeArg = ((ParameterizedTypeInfo) lastParamType).getArgs().get(0); if (typeArg.getKind() == ClassKind.ASYNC_RESULT) { return MethodKind.FUTURE; } else { return MethodKind.HANDLER; } } } return MethodKind.OTHER; }
Example #12
Source File: RowMapperGen.java From vertx-sql-client with Apache License 2.0 | 5 votes |
private static Function<String, String> getter_(TypeInfo type, boolean isArray) { String getter = getter(type); if (getter != null) { return col -> "row." + getter + (isArray ? "Array" : "") + "(\"" + col + "\")"; } if (type.getKind() == ClassKind.ENUM || type instanceof ClassTypeInfo) { if (isArray) { return col -> "row.get(" + type.getName() + "[].class, \"" + col + "\")"; } else { return col -> "row.get(" + type.getName() + ".class, \"" + col + "\")"; } } return null; }
Example #13
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidFunctionType(TypeInfo typeInfo, boolean allowAnyJavaType) { if (typeInfo.getErased().getKind() == ClassKind.FUNCTION) { TypeInfo paramType = ((ParameterizedTypeInfo) typeInfo).getArgs().get(0); if (isValidCallbackValueType(paramType, allowAnyJavaType)) { TypeInfo returnType = ((ParameterizedTypeInfo) typeInfo).getArgs().get(1); return isValidNonCallableType(returnType, true, false, true, allowAnyJavaType); } } return false; }
Example #14
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidVertxGenInterface(TypeInfo type, boolean allowParameterized, boolean allowAnyJavaType) { if (type.getKind() == ClassKind.API) { if (type.isParameterized()) { ParameterizedTypeInfo parameterized = (ParameterizedTypeInfo) type; return allowParameterized && parameterized .getArgs() .stream() .noneMatch(arg -> !isValidVertxGenTypeArgument(arg, allowAnyJavaType) || arg.isNullable()); } else { return true; } } return false; }
Example #15
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidContainer(TypeInfo type, boolean allowAnyJavaType) { TypeInfo argument = null; if (rawTypeIs(type, List.class, Set.class, Map.class)) { ParameterizedTypeInfo parameterizedType = (ParameterizedTypeInfo) type; if (type.getKind() != ClassKind.MAP) { argument = parameterizedType.getArgs().get(0); } else if (parameterizedType.getArgs().get(0).getKind() == ClassKind.STRING) { // Only allow Map's with String's for keys argument= parameterizedType.getArgs().get(1); } } return argument != null && isValidContainerComponent(argument, allowAnyJavaType); }
Example #16
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidClassTypeParam(ExecutableElement elt, TypeInfo type) { if (type.getKind() == ClassKind.CLASS_TYPE && type.isParameterized()) { ParameterizedTypeInfo parameterized = (ParameterizedTypeInfo) type; TypeInfo arg = parameterized.getArg(0); if (arg.isVariable()) { TypeVariableInfo variable = (TypeVariableInfo) arg; for (TypeParameterElement typeParamElt : elt.getTypeParameters()) { if (typeParamElt.getSimpleName().toString().equals(variable.getName())) { return true; } } } } return false; }
Example #17
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 5 votes |
private static boolean isValidNonCallableType(TypeInfo type, boolean isParam, boolean isReturn, boolean allowParameterized, boolean allowAnyJavaType) { if (isValidDataObjectType(type, isParam, isReturn)) { return true; } if (type.getKind() == ClassKind.VOID) { return true; } if (type.getKind().basic) { return true; } if (type.getKind().json) { return true; } if (isValidEnum(type)) { return true; } if (type.getKind() == ClassKind.THROWABLE) { return true; } if (type.isVariable()) { return true; } if (type.getKind() == ClassKind.OBJECT) { return true; } if (isValidVertxGenInterface(type, allowParameterized, allowAnyJavaType)) { return true; } if (isValidOtherType(type, allowAnyJavaType)) { return true; } if (allowParameterized && isValidContainer(type, allowAnyJavaType)) { return true; } return false; }
Example #18
Source File: JsonObjectLiteralModel.java From vertx-codetrans with Apache License 2.0 | 5 votes |
@Override public ExpressionModel as(TypeInfo type) { if (type.getKind() != ClassKind.JSON_OBJECT) { throw new UnsupportedOperationException(); } return this; }
Example #19
Source File: JsonArrayLiteralModel.java From vertx-codetrans with Apache License 2.0 | 5 votes |
@Override public ExpressionModel as(TypeInfo type) { if (type.getKind() != ClassKind.JSON_ARRAY) { throw new UnsupportedOperationException(); } return this; }
Example #20
Source File: RxJavaGenerator.java From vertx-rx with Apache License 2.0 | 5 votes |
@Override protected void genToSubscriber(TypeInfo streamType, PrintWriter writer) { writer.format(" private WriteStreamSubscriber<%s> subscriber;%n", genTranslatedTypeName(streamType)); writer.println(); writer.format(" public synchronized WriteStreamSubscriber<%s> toSubscriber() {%n", genTranslatedTypeName(streamType)); writer.println(" if (subscriber == null) {"); if (streamType.getKind() == ClassKind.API) { writer.format(" Function<%s, %s> conv = %s::getDelegate;%n", genTranslatedTypeName(streamType.getRaw()), streamType.getName(), genTranslatedTypeName(streamType)); writer.println(" subscriber = RxHelper.toSubscriber(getDelegate(), conv);"); } else if (streamType.isVariable()) { String typeVar = streamType.getSimpleName(); writer.format(" Function<%s, %s> conv = (Function<%s, %s>) __typeArg_0.unwrap;%n", typeVar, typeVar, typeVar, typeVar); writer.println(" subscriber = RxHelper.toSubscriber(getDelegate(), conv);"); } else { writer.println(" subscriber = RxHelper.toSubscriber(getDelegate());"); } writer.println(" }"); writer.println(" return subscriber;"); writer.println(" }"); writer.println(); }
Example #21
Source File: RxJavaGenerator.java From vertx-rx with Apache License 2.0 | 4 votes |
@Override protected void genToObservable(TypeInfo streamType, PrintWriter writer) { writer.print(" private Observable<"); writer.print(genTranslatedTypeName(streamType)); writer.println("> observable;"); writer.println(); writer.print(" public synchronized Observable<"); writer.print(genTranslatedTypeName(streamType)); writer.println("> toObservable() {"); writer.print(" "); writer.println("if (observable == null) {"); if (streamType.getKind() == ClassKind.API) { writer.print(" Function<"); writer.print(streamType.getName()); writer.print(", "); writer.print(genTranslatedTypeName(streamType)); writer.print("> conv = "); writer.print(genTranslatedTypeName(streamType.getRaw())); writer.println("::newInstance;"); writer.println(" observable = RxHelper.toObservable(delegate, conv);"); } else if (streamType.isVariable()) { String typeVar = streamType.getSimpleName(); writer.print(" Function<"); writer.print(typeVar); writer.print(", "); writer.print(typeVar); writer.print("> conv = (Function<"); writer.print(typeVar); writer.print(", "); writer.print(typeVar); writer.println(">) __typeArg_0.wrap;"); writer.println(" observable = RxHelper.toObservable(delegate, conv);"); } else { writer.println(" observable = RxHelper.toObservable(this.getDelegate());"); } writer.println(" }"); writer.println(" return observable;"); writer.println(" }"); writer.println(); }
Example #22
Source File: GeneratorUtils.java From vertx-service-proxy with Apache License 2.0 | 4 votes |
public boolean isResultHandler(ParamInfo param) { return param != null && param.getType().getKind() == ClassKind.HANDLER && ((ParameterizedTypeInfo)param.getType()).getArg(0).getKind() == ClassKind.ASYNC_RESULT; }
Example #23
Source File: ClassTestBase.java From vertx-codegen with Apache License 2.0 | 4 votes |
void checkParam(ParamInfo param, String name, String expectedTypeName, ClassKind expectedTypeKind) { assertEquals(name, param.getName()); assertEquals(expectedTypeName.replaceAll(Pattern.quote(" "), ""), param.getType().getName().replaceAll(Pattern.quote(" "), "")); assertEquals(expectedTypeKind, param.getType().getKind()); }
Example #24
Source File: RxJava2Generator.java From vertx-rx with Apache License 2.0 | 4 votes |
private void genToXXXAble(TypeInfo streamType, String rxType, String rxName, PrintWriter writer) { writer.print(" public synchronized "); writer.print(rxType); writer.print("<"); writer.print(genTranslatedTypeName(streamType)); writer.print("> to"); writer.print(rxType); writer.println("() {"); writer.print(" "); writer.print("if ("); writer.print(rxName); writer.println(" == null) {"); if (streamType.getKind() == ClassKind.API) { writer.print(" Function<"); writer.print(streamType.getName()); writer.print(", "); writer.print(genTranslatedTypeName(streamType)); writer.print("> conv = "); writer.print(genTranslatedTypeName(streamType.getRaw())); writer.println("::newInstance;"); writer.print(" "); writer.print(rxName); writer.print(" = "); writer.print(rxType); writer.print("Helper.to"); writer.print(rxType); writer.println("(delegate, conv);"); } else if (streamType.isVariable()) { String typeVar = streamType.getSimpleName(); writer.print(" Function<"); writer.print(typeVar); writer.print(", "); writer.print(typeVar); writer.print("> conv = (Function<"); writer.print(typeVar); writer.print(", "); writer.print(typeVar); writer.println(">) __typeArg_0.wrap;"); writer.print(" "); writer.print(rxName); writer.print(" = "); writer.print(rxType); writer.print("Helper.to"); writer.print(rxType); writer.println("(delegate, conv);"); } else { writer.print(" "); writer.print(rxName); writer.print(" = "); writer.print(rxType); writer.print("Helper.to"); writer.print(rxType); writer.println("(this.getDelegate());"); } writer.println(" }"); writer.print(" return "); writer.print(rxName); writer.println(";"); writer.println(" }"); writer.println(); }
Example #25
Source File: DataObjectCheatsheetGen.java From vertx-codegen with Apache License 2.0 | 4 votes |
private String getDataType(TypeInfo type) { ClassKind kind = type.getKind(); if (kind.basic) { if (kind == ClassKind.STRING) { return "String"; } String typeName = type.getName(); switch (typeName) { case "java.lang.Boolean": case "boolean": return "Boolean"; case "java.lang.Character": case "char": return "Char"; case "java.lang.Byte": case "byte": case "java.lang.Short": case "short": case "java.lang.Integer": case "int": case "java.lang.Long": case "long": case "java.lang.Float": case "float": case "java.lang.Double": case "double": return "Number (" + type.getSimpleName() + ")"; } } else { switch (kind) { case JSON_OBJECT: return "Json object"; case JSON_ARRAY: return "Json array"; // case DATA_OBJECT: // return "link:dataobjects.html#" + type.getRaw().getSimpleName() + '[' + type.getRaw().getSimpleName() + ']'; case ENUM: return "link:enums.html#" + type.getRaw().getSimpleName() + '[' + type.getRaw().getSimpleName() + ']'; case API: if (type.getName().equals("io.vertx.core.buffer.Buffer")) { return "Buffer"; } break; case OTHER: if (type.getName().equals(Instant.class.getName())) { return "Instant"; } break; } } System.out.println("unhandled type " + type); return null; }
Example #26
Source File: ScalaApiModel.java From vertx-codetrans with Apache License 2.0 | 4 votes |
private boolean methodAcceptsAsyncResultHandler(TypeInfo last) { return last.getKind() == ClassKind.HANDLER && ((ParameterizedTypeInfo) last).getArg(0).getKind() == ClassKind.ASYNC_RESULT; }
Example #27
Source File: DataObjectHelperGen.java From vertx-codegen with Apache License 2.0 | 4 votes |
private void genToJson(String visibility, boolean inheritConverter, DataObjectModel model, PrintWriter writer) { String simpleName = model.getType().getSimpleName(); writer.print(" " + visibility + " static void toJson(" + simpleName + " obj, JsonObject json) {\n"); writer.print(" toJson(obj, json.getMap());\n"); writer.print(" }\n"); writer.print("\n"); writer.print(" " + visibility + " static void toJson(" + simpleName + " obj, java.util.Map<String, Object> json) {\n"); model.getPropertyMap().values().forEach(prop -> { if ((prop.isDeclared() || inheritConverter) && prop.getGetterMethod() != null && prop.isJsonifiable()) { ClassKind propKind = prop.getType().getKind(); if (propKind.basic) { if (propKind == ClassKind.STRING) { genPropToJson("", "", prop, writer); } else { switch (prop.getType().getSimpleName()) { case "char": case "Character": genPropToJson("Character.toString(", ")", prop, writer); break; default: genPropToJson("", "", prop, writer); } } } else { DataObjectInfo dataObject = prop.getType().getDataObject(); if (dataObject != null) { if (dataObject.isSerializable()) { String m; MapperInfo mapperInfo = dataObject.getSerializer(); String match; switch (mapperInfo.getKind()) { case SELF: m = ""; match = "." + String.join(".", mapperInfo.getSelectors()) + "()"; break; case STATIC_METHOD: m = mapperInfo.getQualifiedName() + "." + String.join(".", mapperInfo.getSelectors()) + "("; match = ")"; break; default: throw new UnsupportedOperationException(); } genPropToJson(m, match, prop, writer); } else { return; } } else { switch (propKind) { case API: if (prop.getType().getName().equals("io.vertx.core.buffer.Buffer")) { genPropToJson("java.util.Base64.getEncoder().encodeToString(", ".getBytes())", prop, writer); } break; case ENUM: genPropToJson("", ".name()", prop, writer); break; case JSON_OBJECT: case JSON_ARRAY: case OBJECT: genPropToJson("", "", prop, writer); break; case OTHER: if (prop.getType().getName().equals(Instant.class.getName())) { genPropToJson("DateTimeFormatter.ISO_INSTANT.format(", ")", prop, writer); } break; } } } } }); writer.print(" }\n"); }
Example #28
Source File: ParamInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return true when the param is nullable */ public boolean isNullable() { return type.getKind() == ClassKind.OBJECT || type.isNullable(); }
Example #29
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 4 votes |
private static boolean isValidEnum(TypeInfo info) { return info.getKind() == ClassKind.ENUM; }
Example #30
Source File: TypeValidator.java From vertx-codegen with Apache License 2.0 | 4 votes |
private static boolean isValidOtherType(TypeInfo type, boolean allowAnyJavaType) { return allowAnyJavaType && type.getKind() == ClassKind.OTHER; }