Author: Xiao Fu Ge
Blog: https://bugstack.cn
Precipitate, share, grow, so that you and others can gain something! 😄
1. It's hard to admit that you are good
lot of code farmers have narrowed the road
don't think more about the problem, always like to use spears and shields to show their 161d3e26f99a0d skills. Github You write an article saying that you are not as valuable as making open source code. If you write open source code and say it is meaningless, then you ask him what he contributed, and he only contributed his mouth. theory is jingling, writing code is so rare
- Fortunately, you can meet a lot of
friends along the way. They can sincerely give you opinions, provide ideas, and help solve them, so that you can continue to grow as a group of people with technical original intentions.
- This may be the soil for technical creation. If everyone does not fertilize, but stepped on this land vigorously, then everyone will have to die together in the end, and no one should innovate. Come on, I hope you can do something with me
2. What plug-in did you write?
I have been tossing about IDEA Plugin plug-in development case writing technology summary for more than a month, and found a pain point in the daily coding development and tossing plug-in technology process.
There are too many vo2dto object conversion operations in the daily coding process, especially in the DDD architecture, there are many more anti-corrosion layers, and the objects po, vo, do, and dto between this layer always need to be converted. I have used BeanUtils a lot, and I don’t know what will be affected by adding or changing the field name in the future.
Of course, there are also good tools, MapStruct, which can guarantee performance and good efficiency, but it needs to maintain the corresponding conversion class for each conversion object. It is very suitable for the conversion of the interface layer, but it is also in the small method blocks. It seems a little troublesome to toss like this.
So , Xiao Fu combines the ability of IDEA Plugin development to locate the conversion object through the mouse, one-click weaving needs to generate a bunch of x.set(y.get)
methods, and in several optimizations, it can support parent objects and lombok plug-ins. . The demonstration diagram is as follows:
- Support: copy an object, position the cursor on another object, generate the conversion code with the right mouse button Generate -> Vo2Dto
- Support: do not copy the object, directly in the conversion can generate an empty set object, it is convenient to add content freely
- Support: The method of annotation detection in the plug-in allows the use of lombok
Third, the experience of publishing plug-ins
🤔 I didn’t need to describe it in English, so I didn’t give it to me.
1. Please describe in English
- This is the first time I publish the email reminder received by the plugin. Tell me to describe in English in your plugin.xml. has not read it, thinking it is spam
2. Please use English screenshots
- Tell me, your screenshots must be in English so that I can pass it for you.
3. Saying my screenshots are useless
- Ask me are you sure you need this screenshot, he thinks it is meaningless
4. Finally released
- I changed the comments and deleted the screenshots, finally ushering in the dawn. You said, if you don't publish it once, will you know that you have encountered these!
Four, arrange this plug-in
1. Install the plugin
comes to this!
Why am I excited? Because of the release of this plug-in, I waited for 2 weeks, because it takes 2 working days for a modification to be reviewed, so the mistakes I made above are all made out of time.
But now it's fine, you can directly search for and install the plug-in written by Brother Xiao Fu in IDEA, hahaha, doing this kind of thing that hasn't been done once is always very exciting!
- Seeing that vo2dto can be searched and successfully installed and used, I feel more comfortable. No one can stop your most technical love, even if you come to me and step on two feet
2. Introduction
As shown in the figure, you only need very simple steps, which can quickly and accurately help you generate the corresponding conversion code, and it is still very Good
in some scenes! Steps:
- The copied object
UserDto userDto
is the converted object. Only after copying can it be easy to generate code to obtain the attributes. If you do not copy, then it will generate an empty code - Positioning object
User usxxer
the cursor on the object or attribute, click Generate -> Vo2Dto so that your object can be generated. - Note: Support lombok, support inherited objects, if you encounter other needs or problems during use, you can give me feedback
3. Source code sharing
- Source code: https://github.com/fuzhengwei/vo2dto
- Note: Only with the same good technical people can we make a little thing better, so I share this piece of code, and we can make a very short and exquisite product together to help us complete some convenient development processing. .
5. I'm sure to be stubborn
There is a kind of stubbornness that may also be born. I like technology, like toss, like simple and clean things, and stick to what I look for for a long time. Sometimes I also know that the other way will be easier and more money to take, but that is not in my heart. Only the me who I recognize is me, otherwise the me who is imposed on me will never be me.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。