View Javadoc
1   package org.kuali.common.devops.metadata.model;
2   
3   import javax.validation.constraints.Min;
4   
5   import org.kuali.common.core.build.ValidatingBuilder;
6   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
7   
8   @IdiotProofImmutable
9   public final class Memory {
10  	// used=0.62g, free=1.16g, allocated=0.94g, max=1.78g
11  
12  	@Min(0)
13  	private final long used;
14  
15  	@Min(0)
16  	private final long free;
17  
18  	@Min(0)
19  	private final long allocated;
20  
21  	@Min(0)
22  	private final long max;
23  
24  	private Memory(Builder builder) {
25  		this.used = builder.used;
26  		this.free = builder.free;
27  		this.allocated = builder.allocated;
28  		this.max = builder.max;
29  	}
30  
31  	public static Builder builder() {
32  		return new Builder();
33  	}
34  
35  	public static class Builder extends ValidatingBuilder<Memory> {
36  
37  		private long used;
38  		private long free;
39  		private long allocated;
40  		private long max;
41  
42  		public Builder used(long used) {
43  			this.used = used;
44  			return this;
45  		}
46  
47  		public Builder free(long free) {
48  			this.free = free;
49  			return this;
50  		}
51  
52  		public Builder allocated(long allocated) {
53  			this.allocated = allocated;
54  			return this;
55  		}
56  
57  		public Builder max(long max) {
58  			this.max = max;
59  			return this;
60  		}
61  
62  		@Override
63  		public Memory build() {
64  			return validate(new Memory(this));
65  		}
66  
67  	}
68  
69  	public long getUsed() {
70  		return used;
71  	}
72  
73  	public long getFree() {
74  		return free;
75  	}
76  
77  	public long getAllocated() {
78  		return allocated;
79  	}
80  
81  	public long getMax() {
82  		return max;
83  	}
84  
85  }