简介
在日常开发中,可以会用到各种各样的静态变量或工具类,但其实spring源生就提供了很多优秀的静态变量类和工具类,这里简单记录一下。
spring
- org.springframework.http.MediaType
http返回和请求头等信息
- org.springframework.http.HttpStatus
http各种状态码与对应关系
org.dozer
- org.dozer.Mapper
对象之间拷贝属性,类似于org.apache.commons.beanutils.copyProperties(Object dest, Object orig)
源码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53package org.dozer;
/**
* Public root interface for performing Dozer mappings from application code.
*
* @author tierney.matt
* @author garsombke.franz
*/
public interface Mapper {
/**
* Constructs new instance of destinationClass and performs mapping between from source
*
* @param source
* @param destinationClass
* @param <T>
* @return
* @throws MappingException
*/
<T> T map(Object source, Class<T> destinationClass) throws MappingException;
/**
* Performs mapping between source and destination objects
*
* @param source
* @param destination
* @throws MappingException
*/
void map(Object source, Object destination) throws MappingException;
/**
* Constructs new instance of destinationClass and performs mapping between from source
*
* @param source
* @param destinationClass
* @param mapId
* @param <T>
* @return
* @throws MappingException
*/
<T> T map(Object source, Class<T> destinationClass, String mapId) throws MappingException;
/**
* Performs mapping between source and destination objects
*
* @param source
* @param destination
* @param mapId
* @throws MappingException
*/
void map(Object source, Object destination, String mapId) throws MappingException;
}