Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use smalldoc to solve the problem of Chinese Archives Writing in Java Web Development

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about how to use smalldoc to solve the trouble of writing Chinese archives in Java Web development. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Smalldoc-2.3.1 is updated according to issues as follows:

Repair and optimize source-paths and packages configuration

Source-paths has given the source path of the current project by default (that is, the source path of the project on which the smalldoc was introduced-System.getProperty ("user.dir"). 2.3.1 fixed a null pointer error that did not configure the path.

It is only necessary to configure source-paths if you need third-party jar package source code-or if your project is a multi-module project that needs to introduce the source code of other modules.

Packages configures the packages in which the Controller class is located and automatically recurses their child packages. If it is not specified, the default is /. All packets under the source code path will be scanned. It is recommended to specify a package name to improve the resolution speed.

Recursive parsing return parameters

No matter how many layers your returned object has, it can be displayed in the return parameters table, as shown in the following figure

Support for parsing the structure of List elements in the return values of lists or paging interfaces

Fixed * Mapping comment parsing exception. Java.lang.ClassCastException: java.lang.Boolean cannot be cast to [Lcom.sun.javadoc.AnnotationValue; uses annotations to support whether parameters are required, support List,Set, array, and entity parameters.

A common parameter, and only add @ * after the comment to indicate that it is required, otherwise it is optional. Includes basic types, wrapper types of basic types, strings, and their array, List,Set, as well as some library types-- such as File, MultipartFile

Entity parameters, all fields in the entity class may be passed as parameters, and the requirements for passing fields in each interface are different, so it is impossible for us to mark in the DTO entity, which not only has code intrusiveness, but also can not meet the diversity of parameters passed by the interface. Comments for entity parameters can be written in the form of @ {F1 [*], [f2 [*],.]}, either instead of the entire comment or at the end of the comment.

Where f represents a field name of the entity class, through which smalldoc can search for comments on the parameters in the source code of your entity class.

Add * after the field name to indicate that it is required, otherwise it is an optional parameter.

If a field in the entity class does not appear within @ {}, the field will not be used as a parameter.

If there are other comments before @, they will be ignored.

If your parameter is an entity parameter but does not contain this form at the end of the comment, a warning log will be printed to help you pre-locate the problem.

Examples are as follows.

Optimize parameter name display

The optimized parameter names support complex data structures, such as associated objects, association sets, Set,List or arrays, which can be called directly as actual parameter names.

Sample code

/ * Test interface * @ param file file * @ param bb saddas * @ param cc CCCC * @ param pp h is @ * * @ param cca wipe black @ {authorId*} * @ param content content @ * @ param oaCopyArray @ {authorId*,originalArticleId,categoryId*,paragraph.content} * @ param oaCopy @ {authorId*,originalArticleId,categoryId* Paragraph.content} * @ return data- draft ID * / @ RequestMapping ("test_path/action2") public Result test (MultipartFile file, Long [] bb, Long cc, List pp, String content, List cca, OriginalArticleCopy [] oaCopyArray, OriginalArticleCopy oaCopy, HttpServletRequest request) {return null }

Document display

Add a large number of assertions

If your comments are not standardized and cannot generate a reasonable document, smalldoc will print a warning or directly prompt for an exception

Support for offline documents

The original smalldoc-antd-react-ui [https://github.com/liuhuagui/smalldoc-antd-react-ui], in the form of React+Fetch to get the document structure, the new version of the React+ template engine to write, so that support offline documents, you only need to open the document UI interface in the browser, and then Ctrl+S save offline files.

The above is the editor for you to share how to use smalldoc to solve the trouble of writing Chinese archives in Java Web development, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report