io.vertx.codegen.doc.Text Java Examples
The following examples show how to use
io.vertx.codegen.doc.Text.
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: ProxyModel.java From vertx-service-proxy with Apache License 2.0 | 6 votes |
@Override protected MethodInfo createMethodInfo(Set<ClassTypeInfo> ownerTypes, String methodName, String comment, Doc doc, TypeInfo returnType, Text returnDescription, boolean isFluent, boolean isCacheReturn, List<ParamInfo> mParams, ExecutableElement methodElt, boolean isStatic, boolean isDefault, ArrayList<TypeParamInfo.Method> typeParams, TypeElement declaringElt, boolean methodDeprecated, Text methodDeprecatedDesc) { AnnotationMirror proxyIgnoreAnnotation = Helper.resolveMethodAnnotation(ProxyIgnore.class, elementUtils, typeUtils, declaringElt, methodElt); boolean isProxyIgnore = proxyIgnoreAnnotation != null; AnnotationMirror proxyCloseAnnotation = Helper.resolveMethodAnnotation(ProxyClose.class, elementUtils, typeUtils, declaringElt, methodElt); boolean isProxyClose = proxyCloseAnnotation != null; ProxyMethodInfo proxyMeth = new ProxyMethodInfo(ownerTypes, methodName, returnType, returnDescription, isFluent, isCacheReturn, mParams, comment, doc, isStatic, isDefault, typeParams, isProxyIgnore, isProxyClose, methodDeprecated, methodDeprecatedDesc); if (isProxyClose && mParams.size() > 0) { if (mParams.size() > 1) { throw new GenException(this.modelElt, "@ProxyClose methods can't have more than one parameter"); } if (proxyMeth.getKind() != MethodKind.FUTURE) { throw new GenException(this.modelElt, "@ProxyClose parameter must be Handler<AsyncResult<Void>>"); } TypeInfo type = mParams.get(0).getType(); TypeInfo arg = ((ParameterizedTypeInfo) ((ParameterizedTypeInfo) type).getArgs().get(0)).getArgs().get(0); if (arg.getKind() != ClassKind.VOID) { throw new GenException(this.modelElt, "@ProxyClose parameter must be " + "Handler<AsyncResult<Void>> instead of " + type); } } return proxyMeth; }
Example #2
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 6 votes |
public MethodInfo(Set<ClassTypeInfo> ownerTypes, String name, TypeInfo returnType, Text returnDescription, boolean fluent, boolean cacheReturn, List<ParamInfo> params, String comment, Doc doc, boolean staticMethod, boolean defaultMethod, List<TypeParamInfo.Method> typeParams, boolean deprecated, Text deprecatedDesc) { this.comment = comment; this.name = name; this.returnType = returnType; this.returnDescription = returnDescription; this.fluent = fluent; this.cacheReturn = cacheReturn; this.doc = doc; this.staticMethod = staticMethod; this.defaultMethod = defaultMethod; this.params = params; this.typeParams = typeParams; this.ownerTypes = ownerTypes; this.deprecated = deprecated; this.deprecatedDesc = deprecatedDesc; }
Example #3
Source File: WebApiProxyModel.java From vertx-web with Apache License 2.0 | 5 votes |
@Override protected MethodInfo createMethodInfo(Set<ClassTypeInfo> ownerTypes, String methodName, String comment, Doc doc, TypeInfo returnType, Text returnDescription, boolean isFluent, boolean isCacheReturn, List<ParamInfo> mParams, ExecutableElement methodElt, boolean isStatic, boolean isDefault, ArrayList<TypeParamInfo.Method> typeParams, TypeElement declaringElt, boolean methodDeprecated, Text deprecatedDesc) { ProxyMethodInfo baseInfo = (ProxyMethodInfo) super.createMethodInfo(ownerTypes, methodName, comment, doc, returnType, returnDescription, isFluent, isCacheReturn, mParams, methodElt, isStatic, isDefault, typeParams, declaringElt, methodDeprecated, deprecatedDesc); if (!isStatic && !baseInfo.isProxyClose()) { // Check signature constraints TypeInfo ret; if (baseInfo.getKind() == MethodKind.FUTURE) { ret = ((ParameterizedTypeInfo) ((ParameterizedTypeInfo) mParams.get(mParams.size() - 1).getType()).getArg(0)).getArg(0); } else { throw new GenException(methodElt, SIGNATURE_CONSTRAINT_ERROR); } if (!ServiceResponse.class.getName().equals(ret.getName())) { throw new GenException(methodElt, SIGNATURE_CONSTRAINT_ERROR); } TypeInfo shouldBeServiceRequest; if (baseInfo.getKind() == MethodKind.FUTURE) { if (mParams.size() <= 1) { throw new GenException(methodElt, SIGNATURE_CONSTRAINT_ERROR); } shouldBeServiceRequest = mParams.get(mParams.size() - 2).getType(); } else { if (mParams.size() == 0) { throw new GenException(methodElt, SIGNATURE_CONSTRAINT_ERROR); } shouldBeServiceRequest = mParams.get(mParams.size() - 1).getType(); } if (!ServiceRequest.class.getName().equals(shouldBeServiceRequest.getName())) { throw new GenException(methodElt, SIGNATURE_CONSTRAINT_ERROR); } return new WebApiProxyMethodInfo(baseInfo); } else { return baseInfo; } }
Example #4
Source File: ProxyMethodInfo.java From vertx-service-proxy with Apache License 2.0 | 5 votes |
public ProxyMethodInfo(Set<ClassTypeInfo> ownerTypes, String name, TypeInfo returnType, Text returnDescription, boolean fluent, boolean cacheReturn, List<ParamInfo> params, String comment, Doc doc, boolean staticMethod, boolean defaultMethod, List<TypeParamInfo.Method> typeParams, boolean proxyIgnore, boolean proxyClose, boolean deprecated, Text deprecatedDesc) { super(ownerTypes, name, returnType, returnDescription, fluent, cacheReturn, params, comment, doc, staticMethod, defaultMethod, typeParams, deprecated, deprecatedDesc); this.proxyIgnore = proxyIgnore; this.proxyClose = proxyClose; }
Example #5
Source File: ParamInfo.java From vertx-codegen with Apache License 2.0 | 5 votes |
public ParamInfo(int index, String name, Text description, TypeInfo type, TypeInfo unresolvedType) { this.index = index; this.name = name; this.description = description; this.type = type; this.unresolvedType = unresolvedType; }
Example #6
Source File: PropertyInfo.java From vertx-codegen with Apache License 2.0 | 5 votes |
public PropertyInfo(boolean declared, String name, Doc doc, TypeInfo type, String setterMethod, String adderMethod, String getterMethod, List<AnnotationValueInfo> annotations, PropertyKind kind, boolean jsonifiable, boolean deprecated, Text deprecatedDesc) { this.kind = kind; this.declared = declared; this.name = name; this.doc = doc; this.type = type; this.annotations = annotations.stream().collect(HashMap::new, (m, a) -> m.put(a.getName(), a), HashMap::putAll); this.adderMethod = adderMethod; this.setterMethod = setterMethod; this.getterMethod = getterMethod; this.jsonifiable = jsonifiable; this.deprecated = deprecated; this.deprecatedDesc = deprecatedDesc; }
Example #7
Source File: ClassModel.java From vertx-codegen with Apache License 2.0 | 5 votes |
protected MethodInfo createMethodInfo(Set<ClassTypeInfo> ownerTypes, String methodName, String comment, Doc doc, TypeInfo returnType, Text returnDescription, boolean isFluent, boolean isCacheReturn, List<ParamInfo> mParams, ExecutableElement methodElt, boolean isStatic, boolean isDefault, ArrayList<TypeParamInfo.Method> typeParams, TypeElement declaringElt, boolean methodDeprecated, Text methodDeprecatedDesc) { return new MethodInfo(ownerTypes, methodName, returnType, returnDescription, isFluent, isCacheReturn, mParams, comment, doc, isStatic, isDefault, typeParams, methodDeprecated, methodDeprecatedDesc); }
Example #8
Source File: EnumModel.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #9
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public Text getReturnDescription() { return returnDescription; }
Example #10
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public MethodInfo setReturnDescription(Text returnDescription) { this.returnDescription = returnDescription; return this; }
Example #11
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #12
Source File: MethodInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public MethodInfo setDeprecatedDesc(Text deprecatedDesc) { this.deprecatedDesc = deprecatedDesc; return this; }
Example #13
Source File: DataObjectModel.java From vertx-codegen with Apache License 2.0 | 4 votes |
private void traverse() { DataObject ann = modelElt.getAnnotation(DataObject.class); this.generateConverter = ann.generateConverter(); this.publicConverter = ann.publicConverter(); this.inheritConverter = ann.inheritConverter(); this.isClass = modelElt.getKind() == ElementKind.CLASS; this.concrete = isClass && !modelElt.getModifiers().contains(Modifier.ABSTRACT); try { this.type = (ClassTypeInfo) typeFactory.create(modelElt.asType()); } catch (ClassCastException e) { throw new GenException(modelElt, "Data object must be a plain java class with no type parameters"); } Helper.checkUnderModule(this, "@VertxGen"); doc = docFactory.createDoc(modelElt); if (doc != null) doc.getBlockTags().stream().filter(tag -> tag.getName().equals("deprecated")).findFirst().ifPresent(tag -> deprecatedDesc = new Text(Helper.normalizeWhitespaces(tag.getValue())).map(Token.tagMapper(elementUtils, typeUtils, modelElt)) ); if (getModule() == null) { throw new GenException(modelElt, "Data object must have an ancestor package annotated with @ModuleGen"); } modelElt.getInterfaces().stream() .filter(superTM -> superTM instanceof DeclaredType && ((DeclaredType) superTM).asElement().getAnnotation(DataObject.class) != null) .map(e -> (ClassTypeInfo) typeFactory.create(e)).forEach(abstractSuperTypes::add); superTypes.addAll(abstractSuperTypes); TypeMirror superClass = modelElt.getSuperclass(); if (superClass instanceof DeclaredType && ((DeclaredType) superClass).asElement().getAnnotation(DataObject.class) != null) { superType = (ClassTypeInfo) typeFactory.create(superClass); superTypes.add(superType); } List<ExecutableElement> methodsElt = new ArrayList<>(); for (Element enclosedElt : elementUtils.getAllMembers(modelElt)) { switch (enclosedElt.getKind()) { case CONSTRUCTOR: ExecutableElement constrElt = (ExecutableElement) enclosedElt; processConstructor(constrElt); break; case METHOD: { ExecutableElement methodElt = (ExecutableElement) enclosedElt; if (methodElt.getSimpleName().toString().equals("toJson") && methodElt.getParameters().isEmpty() && typeFactory.create(methodElt.getReturnType()).getKind() == ClassKind.JSON_OBJECT) { hasToJsonMethod = true; } if (methodElt.getSimpleName().contentEquals("decode") && methodElt.getModifiers().containsAll(Arrays.asList(Modifier.STATIC, Modifier.PUBLIC)) && methodElt.getParameters().size() == 1 && typeFactory.create(methodElt.getParameters().get(0).asType()).getKind() == ClassKind.JSON_OBJECT && typeUtils.isSameType(methodElt.getReturnType(), this.modelElt.asType())) { hasDecodeStaticMethod = true; } if (methodElt.getAnnotation(GenIgnore.class) == null) { methodsElt.add(methodElt); } break; } } } processMethods(methodsElt); // Sort the properties so we do have a consistent order ArrayList<PropertyInfo> props = new ArrayList<>(propertyMap.values()); Collections.sort(props, (p1, p2) -> p1.name.compareTo(p2.name)); propertyMap.clear(); props.forEach(prop -> propertyMap.put(prop.name, prop)); }
Example #14
Source File: ClassModel.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #15
Source File: DataObjectModel.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #16
Source File: PropertyInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #17
Source File: ParamInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public ParamInfo(int index, String name, Text description, TypeInfo type) { this(index, name, description, type, null); }
Example #18
Source File: EnumValueInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
/** * @return the description of deprecated */ public Text getDeprecatedDesc() { return deprecatedDesc; }
Example #19
Source File: ParamInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public Text getDescription() { return description; }
Example #20
Source File: EnumValueInfo.java From vertx-codegen with Apache License 2.0 | 4 votes |
public EnumValueInfo(String identifier, Doc doc, boolean deprecated, Text deprecatedDesc) { this.identifier = identifier; this.doc = doc; this.deprecated = deprecated; this.deprecatedDesc = deprecatedDesc; }
Example #21
Source File: WebApiProxyMethodInfo.java From vertx-web with Apache License 2.0 | 4 votes |
public WebApiProxyMethodInfo(Set<ClassTypeInfo> ownerTypes, String name, TypeInfo returnType, Text returnDescription, boolean fluent, boolean cacheReturn, List<ParamInfo> params, String comment, Doc doc, boolean staticMethod, boolean defaultMethod, List<TypeParamInfo.Method> typeParams, boolean proxyIgnore, boolean proxyClose, boolean deprecated, Text deprecatedDesc) { super(ownerTypes, name, returnType, returnDescription, fluent, cacheReturn, params, comment, doc, staticMethod, defaultMethod, typeParams, proxyIgnore, proxyClose, deprecated, deprecatedDesc); paramsToExtract = params.subList(0, params.size() - 2); requestContextName = params.get(params.size() - 2).getName(); }