PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/src/main/java/nl/bitbrains/nebu/common/topology/PhysicalResourceBuilder.java

https://github.com/deltaforge/nebu-common-java
Java | 47 lines | 20 code | 7 blank | 20 comment | 0 complexity | 736e3efc310da3fcdfc9eb17ea2bf884 MD5 | raw file
 1package nl.bitbrains.nebu.common.topology;
 2
 3import nl.bitbrains.nebu.common.interfaces.IBuilder;
 4import nl.bitbrains.nebu.common.util.ErrorChecker;
 5
 6/**
 7 * Builder for the PhysicalResources.
 8 * 
 9 * @param <T>
10 *            Type to build.
11 * @author Jesse Donkervliet, Tim Hegeman, and Stefan Hugtenburg
12 */
13public abstract class PhysicalResourceBuilder<T> implements IBuilder<T> {
14
15    private String uuid;
16
17    /**
18     * Simple default (empty) constructor.
19     */
20    public PhysicalResourceBuilder() {
21    }
22
23    @Override
24    public void reset() {
25        this.uuid = null;
26    }
27
28    /**
29     * @param uuid
30     *            to set.
31     * @return this for fluency.
32     */
33    public PhysicalResourceBuilder<T> withUuid(final String uuid) {
34        ErrorChecker.throwIfNullArgument(uuid, PhysicalResource.UUID_NAME);
35        this.uuid = uuid;
36        return this;
37    }
38
39    /**
40     * Simple getter.
41     * 
42     * @return the uuid.
43     */
44    protected String getUUID() {
45        return this.uuid;
46    }
47}