This repository was archived by the owner on Oct 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
CodeBuilder
cezarmathe edited this page Jun 21, 2019
·
3 revisions
CodeBuilder is a utility class the aids in the process of creating a Code: instead of having to write a lot of setters after instantiating a Code object, you have to chain a number of methods and that's it.
- createBuilder() create a new CodeBuilder instance(used for method chaining)
- build() return the Code that's being built
- withIdentifier() assign an identifier to the Code that's being built
- withOwner() assign an owner to the Code that's being built
- withPasscode() assign a passcode to the Code that's being built
- withIdentifier() assign an identifier to the Code that's being built
- withName() assign a name to the Code that's being built
- withUrl() assign an URL to the Code that's being built
- withPublicStatus() change the public status flag for the Code that's being built
- withCreateTime() assign a create timestamp to the Code that's being built
- withUpdateTime() assign an update timestamp to the Code that's being built
Code Code = CodeBuilder.createBuilder().withIdentifier("aB12")
.withOwner("examplename")
.withPasscode("ExaMple_PaSscode121")
.withName("An example code")
.withPublicStatus(true)
.withUrl(new URL("https://example.com"))
.withCreateTime(new Instant(1560354133))
.withUpdateTime(new Instant(1560357733))
.build(); // returns a Code with the given field values