1 package org.kuali.common.devops.heap; 2 3 import static org.kuali.common.util.base.Precondition.checkMin; 4 5 public final class Heap { 6 7 private final long young; 8 private final long old; 9 private final long perm; 10 11 private Heap(Builder builder) { 12 this.young = builder.young; 13 this.old = builder.old; 14 this.perm = builder.perm; 15 } 16 17 public static Builder builder() { 18 return new Builder(); 19 } 20 21 public static class Builder implements org.apache.commons.lang3.builder.Builder<Heap> { 22 23 private long young = -1; 24 private long old = -1; 25 private long perm = -1; 26 27 public Builder withYoung(long young) { 28 this.young = young; 29 return this; 30 } 31 32 public Builder withOld(long old) { 33 this.old = old; 34 return this; 35 } 36 37 public Builder withPerm(long perm) { 38 this.perm = perm; 39 return this; 40 } 41 42 @Override 43 public Heap build() { 44 return validate(new Heap(this)); 45 } 46 47 private static Heap validate(Heap reference) { 48 checkMin(reference.perm, 0, "perm"); 49 checkMin(reference.old, 0, "old"); 50 checkMin(reference.young, 0, "young"); 51 return reference; 52 } 53 } 54 55 public long getYoung() { 56 return young; 57 } 58 59 public long getOld() { 60 return old; 61 } 62 63 public long getPerm() { 64 return perm; 65 } 66 67 }