当前位置:网站首页>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
边栏推荐
- Web3 entrepreneurship has all the elements of explosive growth of innovation
- C#程序设计的6大原则
- Dear bosses, how can I print the result of Flink SQL to the console and display it completely?
- 2022 latest examination questions and answers of eight members (standard staff) of Shanghai Architecture
- I/O案例实操
- 【饭谈】细说:下克上,向上管理,向上画饼。
- Research: more than 70% of doctors are still prescribing unsafe antibiotic drugs
- 工作面试总遇秒杀? 看了京东 T8 大咖私藏的秒杀系统笔记, 已献出膝盖
- How to evaluate hardware resources (number of CPUs, memory size) when Oracle migrates from small computers to x86 architecture? Is there a measurement index or company?
- ORIGYN基金会正式启动$OGY Staking,引领新一轮生态利好
猜你喜欢

【Flink】FLink RocksDBListState 报错 You cannot add null to a ListState

I'm also drunk. Eureka delayed registration and this pit!

性能调试 -- Chrome Performance

JMeter distributed pressure measurement

Why do independent sellers like to do e-mail marketing? The original conversion rate can be improved so much!

Babbitt | metauniverse daily must read: the popularity of virtual people has decreased, and some "debut is the peak", and the onlookers have dispersed

Research: more than 70% of doctors are still prescribing unsafe antibiotic drugs

PE格式: 分析IatHook并实现

我也是醉了,Eureka 延迟注册还有这个坑!

【leetcode天梯】链表 · 876 查找链表中间结点
随机推荐
Idea resolves the prompt of profile properties disappear
Naming rules for BSP of Quanzhi chip
GPON介绍及华为OLT网关注册配置流程
Ability to choose
【面试:并发篇25:多线程:volatile】可见性
Shopify sellers: share some tips for social media marketing!
C#常见的集合
Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
Autojs learning - Automatic screenshot of the king
GDB locates the main address of the program after strip
How to choose sentinel vs. hystrix current limiting?
函数栈帧的创建和销毁
2022 latest examination questions and answers of eight members (standard staff) of Shanghai Architecture
Create EDA - why should I learn EDA
Redis usage details
Bitcoin.com:USDD代表了真正去中心化稳定币
ag 搜索工具参数详解
H5 realize the animation effect of a scratch card
Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees
JMeter distributed pressure measurement