当前位置:网站首页>Basic knowledge in the project
Basic knowledge in the project
2022-07-25 21:45:00 【I can't get up in the morning!】
List of articles
Boolean.TRUE and true Performance comparison
- A,D > B,C
// 7.844
Boolean A(){
return Boolean.TRUE;
}
// 10.109
boolean B(){
return Boolean.TRUE
}
// 7.906
Boolean C(){
return true;
}
// 7.828
boolean D(){
return true;
}
The string is empty isEmpty and isBlank The difference between
- isEmpty Just judge the null and length as 0 character string
- isBlank The judgment is empty , The length is 0, Blank character ( Including Spaces , tabs \t, A newline \n, Page identifier \f, enter \r) Composed string
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("aaa") = false
StringUtils.isEmpty("\t \n \r \f") = false
StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUitls.isBlank(" ") = true
StringUtils.isEmpty("aaa") = false
StringUtils.isEmpty("\t \n \r \f") = true
- hutool Tools :StrUtil
System.out.println(StrUtil.isEmpty(null)); // true
System.out.println(StrUtil.isEmpty("")); // true
System.out.println(StrUtil.isEmpty(" ")); // false
System.out.println(StrUtil.isEmpty("aaa")); // false
System.out.println(StrUtil.isEmpty("\r \t \n \f")); // false
System.out.println(StrUtil.isBlank(null)); // true
System.out.println(StrUtil.isBlank("")); // true
System.out.println(StrUtil.isBlank(" ")); // true
System.out.println(StrUtil.isBlank("aaa")); // false
System.out.println(StrUtil.isBlank("\r \n \t \f")); // true
Swagger-ApiModel and ApiModelProperty
- ApiModel annotation : This attribute is to describe the interface related entity classes that need special description
| The attribute name | Attribute types | The default value is | effect |
|---|---|---|---|
| value() | String | empty | Name of custom class |
| description() | String | empty | Add long text description information to the class |
- ApiModelProperty annotation : This attribute is a description of the parameters in the entity class
| The attribute name | Attribute types | The default value is | effect |
|---|---|---|---|
| value() | String | empty | Define parameter description information |
| name() | String | empty | Define the parameter name |
| required() | boolean | false | Define whether parameters must be passed |
| hidden() | boolean | false | Define whether the parameter is hidden |
| allowEmptyValue() | boolean | false | Define whether the parameter can be null |
@ApiModel(value = " User entity , Store user related fields ", description = " The user entity contains all business fields related to the user , If necessary, please add another ")
public class User{
// do something...
}
@ApiModelProperty(value = " user Id")
private Integer id;
Swagger-ApiOperation and ApiParam
- @ApiOperation Annotations are not Spring Self contained , It is swagger Inside com.wordnik.swagger.annotations.ApiOperation;
- annotation @ApiOperation and @ApiParam It's used to build Api Document
- @ApiOperation(value=“ Interface specification ”,httpMethod=“ Interface request mode ”,response=“ Interface return parameter type ”,notes=“ Interface release notes ”), Used in the method of request , Explain the purpose of the method 、 effect
- @ApiParam(required =“ Whether the parameter ”,name=“ Parameter name ”,value=“ Parameter description ”)
Other notes :
- @ApiImplicitParams: Used in the method of request , Represents a set of parameter descriptions
- @Api: For the requested class , Represents a description of a class
- @ApiImplicitParams: Used in the method of request , Represents a set of parameter descriptions
- @ApiResponses: Used in the method of request , Represents a set of responses
- Reference link
BeanUtils.copyProperties
Shallow copy , If they are all single attributes , So it's not about deep copy , Suitable for use BeanUtils
BeanUtils.copyProperties(a, b);
- b Properties that exist in ,a There must be , however a There can be extra attributes in the ;
- a China and b The same attributes in the are replaced , Whether it's worth it or not ;
- a、 b The attributes in the should have the same name , Can be assigned , Otherwise, manual assignment is required ;
- Spring Of BeanUtils Of CopyProperties The corresponding properties required by the method are getter and setter Method ;
- If there is an inner class with exactly the same properties , But not the same inner class , That is, they belong to their own internal classes , be spring Will think that the properties are different , Can't copy;
- spring and apache Of copy The position of the method source and destination parameters of the property is exactly the opposite , Therefore, we should pay attention to both guiding package and calling
边栏推荐
- Protobuf的简单使用
- [interview: concurrent Part 24: multithreading: comprehensive exercise] sequence control
- [redis underlying parsing] linked list type
- Fusing and degrading Sentinel
- Pyqt5 use pyqtgraph to draw multiple y-value scatter plots
- 2022 latest examination questions and answers of eight members (standard staff) of Shanghai Architecture
- Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees
- Experience sharing of system architecture designers preparing for the exam: from point to surface
- Ijcai2022 meeting! Microsoft and other tutorials on domain generalization
- Share | intelligent fire emergency management platform solution (PDF attached)
猜你喜欢

【leetcode天梯】链表 · 876 查找链表中间结点

Idea resolves the prompt of profile properties disappear

Redis 使用详解

Zero basic learning canoe panel (17) -- panel CAPL function

SSH private key realizes login to remote target server

Oxford University: many common insomnia drugs lack long-term safety data

MySQL master-slave configuration

Trusted and controllable way of Tencent cloud database

Lichuang EDA -- creation of devices 01 resistance (II)

How will Web3 change the future of people?
随机推荐
Lichuang EDA -- creation of devices 01 resistance (II)
【面试:并发篇23:多线程:join】join再理解
IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程
New maixhub deployment (v831 and k210)
Autojs learning - Automatic screenshot of the king
【C语言入门】ZZULIOJ 1016-1020
Experience sharing of system architecture designers preparing for the exam: from point to surface
【面试:并发篇24:多线程:综合练习】顺序控制
Stm3 (cubeide) lighting experiment
Redis 使用详解
2022-07-18: what is the output of the following go language code? A:Groutine; B:Main; C:Goroutine; D:GoroutineMain。 package m
[leetcode ladder] linked list · 876 find the middle node of the linked list
[ManageEngine] value brought by Siem to enterprises
[redis underlying parsing] linked list type
再次来光顾
字节一面:TCP 和 UDP 可以使用同一个端口吗?
Naming rules for BSP of Quanzhi chip
Vivo official website app full model UI adaptation scheme
QT | learn about QT creator by creating a simple project
The noise reduction effect is increased by more than 6 times! With the microphone inside the headset, this wireless noise reduction headset is unusual!