forked from hellokaton/write-readable-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample6.java
More file actions
33 lines (27 loc) · 871 Bytes
/
Copy pathExample6.java
File metadata and controls
33 lines (27 loc) · 871 Bytes
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
package chapter_09;
import org.apache.commons.beanutils.BeanUtils;
/**
* 简化表达式的创意方法
*
* @author biezhi
* @date 2018/7/14
*/
public class Example6 {
class Stats {
long totalMemory;
long freeMemory;
long swapMemory;
int numProcesses;
String statusString;
}
public void addStats(Stats addFrom, Stats addTo) {
addTo.totalMemory = addFrom.totalMemory + addTo.totalMemory;
addTo.freeMemory = addFrom.freeMemory + addTo.freeMemory;
addTo.swapMemory = addFrom.swapMemory + addTo.swapMemory;
addTo.swapMemory = addFrom.swapMemory + addTo.swapMemory;
addTo.statusString = addFrom.statusString + addTo.statusString;
addTo.numProcesses = addFrom.numProcesses + addTo.numProcesses;
// ...
// BeanUtils.copyProperties();
}
}