private boolean isLegalDataObjectTypeParam(TypeInfo type) { if (type.getKind() == ClassKind.DATA_OBJECT) { DataObjectTypeInfo classType = (DataObjectTypeInfo) type; return !classType.isAbstract(); } return false; }
/** * Translate the current type name based on the module group package name and the specified * {@code lang} parameter. This has effect only for {@link ApiTypeInfo} or * {@link ParameterizedTypeInfo} types. * * @param lang the target language, for instance {@literal groovy} * @return the translated name */ public String translateName(String lang) { return translateName(TypeNameTranslator.hierarchical(lang)); }
public static TypeUse createParamTypeUse(ProcessingEnvironment env, ExecutableElement[] methods, int index) { TypeInternal[] internals = new TypeInternal[methods.length]; for (int i = 0;i < methods.length;i++) { for (TypeInternalProvider provider : providers) { internals[i] = provider.forParam(env, methods[i], index); if (internals[i] != null) { break; } } } return new TypeUse(internals); }
/** * @return true when the param is nullable */ public boolean isNullable() { return type.getKind() == ClassKind.OBJECT || type.isNullable(); }
public static boolean isParentConcrete(Collection<TypeInfo> superTypes) { for (TypeInfo stype : superTypes) { if (((ApiTypeInfo)stype.getRaw()).isConcrete()) { return true; } } return false; }
private boolean isLegalArgumentContainerReturn(TypeInfo argument, boolean allowAnyJavaType) { ClassKind argumentKind = argument.getKind(); return argumentKind.basic || argumentKind.json || argumentKind == ClassKind.OBJECT || (allowAnyJavaType && argumentKind == ClassKind.OTHER); }
public TypeInfo getHandlerType() { return (type.getKind() == ClassKind.API) ? ((ApiTypeInfo)type).getHandlerArg() : null; }
/** * @return the @{link #getName} value of this type */ public String toString() { return getName(); }
public ArrayTypeInfo create(TypeUse use, ArrayType type) { TypeMirror componentType = type.getComponentType(); return new ArrayTypeInfo(create(componentType), use != null && use.isNullable()); }
/** * @return true if the method has a nullable return */ public boolean isNullableReturn() { return returnType.isNullable(); }
public TypeUse.TypeInternal forReturn(ProcessingEnvironment env, ExecutableElement methodElt) { Method methodRef = getMethod(env, methodElt); if (methodRef == null) { return null; } AnnotatedType annotated = methodRef.getAnnotatedReturnType(); return new ReflectType(annotated); } });
public static TypeUse createReturnTypeUse(ProcessingEnvironment env, ExecutableElement... methods) { TypeInternal[] internals = new TypeInternal[methods.length]; for (int i = 0;i < methods.length;i++) { for (TypeInternalProvider provider : providers) { internals[i] = provider.forReturn(env, methods[i]); if (internals[i] != null) { break; } } } return new TypeUse(internals); }
/** * Translate a given {@code qualified name} based on the module group package name and the specified * {@code lang} parameter. * * @param qualifiedName the qualified name * @param lang the language, for instance {@literal groovy} * @return the translated qualified name */ public String translateQualifiedName(String qualifiedName, String lang) { return TypeNameTranslator.hierarchical(lang).translate(this, qualifiedName); }
@Override String format(boolean qualified) { return componentType.format(qualified) + "[]"; } }
@Override public ModuleInfo getModule() { return type.getModule(); } }
public TypeUse.TypeInternal forParam(ProcessingEnvironment env, ExecutableElement methodElt, int paramIndex) { Method methodRef = getMethod(env, methodElt); if (methodRef == null) { return null; } AnnotatedType annotated = methodRef.getAnnotatedParameterTypes()[paramIndex]; return new ReflectType(annotated); } public TypeUse.TypeInternal forReturn(ProcessingEnvironment env, ExecutableElement methodElt) {
/** * @return the declaration suitable for source code represented using unqualified names, for instance * <code>Handler<Buffer></code> */ public String getSimpleName() { return format(false); }
/** * @return the declaration suitable for source code represented using qualified names, for instance * <code>io.vertx.core.Handler<io.vertx.core.buffer.Buffer></code> */ public String getName() { return format(true); }