View Javadoc
1   package org.kuali.common.devops.archive.sweep;
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   /**
9    * Models the S3 metadata required by S3FS
10   */
11  @IdiotProofImmutable
12  public final class PathAttributes {
13  
14  	private final int gid;
15  	private final int uid;
16  	private final int mode;
17  	@Min(0)
18  	private final long mtime;
19  
20  	private PathAttributes(Builder builder) {
21  		this.gid = builder.gid;
22  		this.uid = builder.uid;
23  		this.mode = builder.mode;
24  		this.mtime = builder.mtime;
25  	}
26  
27  	public static Builder builder() {
28  		return new Builder();
29  	}
30  
31  	public static class Builder extends ValidatingBuilder<PathAttributes> {
32  
33  		private int gid;
34  		private int uid;
35  		private int mode;
36  		private long mtime = -1; // prevent builder().build(), force them to know enough about how to use this object to be able to at least set mtime
37  
38  		public Builder withGid(int gid) {
39  			this.gid = gid;
40  			return this;
41  		}
42  
43  		public Builder withUid(int uid) {
44  			this.uid = uid;
45  			return this;
46  		}
47  
48  		public Builder withMode(int mode) {
49  			this.mode = mode;
50  			return this;
51  		}
52  
53  		public Builder withMtime(long mtime) {
54  			this.mtime = mtime;
55  			return this;
56  		}
57  
58  		@Override
59  		public PathAttributes build() {
60  			return validate(new PathAttributes(this));
61  		}
62  	}
63  
64  	public int getGid() {
65  		return gid;
66  	}
67  
68  	public int getUid() {
69  		return uid;
70  	}
71  
72  	public int getMode() {
73  		return mode;
74  	}
75  
76  	public long getMtime() {
77  		return mtime;
78  	}
79  
80  }