SlaveOptions implements Describable<SlaveOptions>, Serializable { public @Nonnull SlaveOptions eraseDefaults(@Nonnull SlaveOptions defaults) { return new Builder() .bootSource(_erase(this.bootSource, defaults.bootSource)) .hardwareId(_erase(this.hardwareId, defaults.hardwareId)) .networkId(_erase(this.networkId, defaults.networkId)) .userDataId(_erase(this.userDataId, defaults.userDataId)) .instanceCap(_erase(this.instanceCap, defaults.instanceCap)) .instancesMin(_erase(this.instancesMin, defaults.instancesMin)) .floatingIpPool(_erase(this.floatingIpPool, defaults.floatingIpPool)) .securityGroups(_erase(this.securityGroups, defaults.securityGroups)) .availabilityZone(_erase(this.availabilityZone, defaults.availabilityZone)) .startTimeout(_erase(this.startTimeout, defaults.startTimeout)) .keyPairName(_erase(this.keyPairName, defaults.keyPairName)) .numExecutors(_erase(this.numExecutors, defaults.numExecutors)) .jvmOptions(_erase(this.jvmOptions, defaults.jvmOptions)) .fsRoot(_erase(this.fsRoot, defaults.fsRoot)) .launcherFactory(_erase(this.launcherFactory, defaults.launcherFactory)) .nodeProperties(_erase(this.nodeProperties, defaults.nodeProperties)) .retentionTime(_erase(this.retentionTime, defaults.retentionTime)) .configDrive(_erase(this.configDrive, defaults.configDrive)) .build() ; } SlaveOptions(Builder b); @DataBoundConstructor @Restricted(NoExternalUse.class)  SlaveOptions(
            @CheckForNull BootSource bootSource,
            String hardwareId,
            String networkId,
            String userDataId,
            Integer instanceCap,
            Integer instancesMin,
            String floatingIpPool,
            String securityGroups,
            String availabilityZone,
            Integer startTimeout,
            String keyPairName,
            Integer numExecutors,
            String jvmOptions,
            String fsRoot,
            LauncherFactory launcherFactory,
            @CheckForNull List<? extends NodeProperty<?>> nodeProperties,
            Integer retentionTime,
            @CheckForNull Boolean configDrive
    ); @CheckForNull String getFsRoot(); @CheckForNull BootSource getBootSource(); @CheckForNull String getHardwareId(); @CheckForNull String getNetworkId(); @CheckForNull String getUserDataId(); Integer getInstanceCap(); Integer getInstancesMin(); @CheckForNull String getFloatingIpPool(); String getSecurityGroups(); @CheckForNull String getAvailabilityZone(); Integer getStartTimeout(); @CheckForNull String getKeyPairName(); Integer getNumExecutors(); @CheckForNull String getJvmOptions(); LauncherFactory getLauncherFactory(); @CheckForNull List<NodeProperty<?>> getNodeProperties(); Integer getRetentionTime(); @CheckForNull Boolean getConfigDrive(); @Nonnull SlaveOptions override(@Nonnull SlaveOptions o); @Nonnull SlaveOptions eraseDefaults(@Nonnull SlaveOptions defaults); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); Builder getBuilder(); static @Nonnull SlaveOptions empty(); static @Nonnull Builder builder(); @Override SlaveOptionsDescriptor getDescriptor();  }
@Test public void eraseDefaults() { SlaveOptions defaults = SlaveOptions.builder().bootSource(new BootSource.Image("ID")).hardwareId("hw").networkId(null).floatingIpPool("a").build(); SlaveOptions configured = SlaveOptions.builder().bootSource(new BootSource.Image("ID")).hardwareId("hw").networkId("MW").floatingIpPool("A").build(); SlaveOptions actual = configured.eraseDefaults(defaults); SlaveOptions expected = SlaveOptions.builder().bootSource(null).hardwareId(null).networkId("MW").floatingIpPool("A").build(); assertEquals(expected, actual); assertEquals(configured, defaults.override(actual)); }