Package com.io7m.waxmill.machines
Class WXMVirtualMachine.Builder
java.lang.Object
com.io7m.waxmill.machines.WXMVirtualMachine.Builder
- Enclosing class:
- WXMVirtualMachine
public static final class WXMVirtualMachine.Builder
extends java.lang.Object
Builds instances of type
WXMVirtualMachine.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and Type Method Description WXMVirtualMachine.BuilderaddAllBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Adds elements tobootConfigurationslist.WXMVirtualMachine.BuilderaddAllDevices(java.lang.Iterable<? extends WXMDeviceType> elements)Adds elements todeviceslist.WXMVirtualMachine.BuilderaddBootConfigurations(WXMBootConfigurationType element)Adds one element tobootConfigurationslist.WXMVirtualMachine.BuilderaddBootConfigurations(WXMBootConfigurationType... elements)Adds elements tobootConfigurationslist.WXMVirtualMachine.BuilderaddDevices(WXMDeviceType element)Adds one element todeviceslist.WXMVirtualMachine.BuilderaddDevices(WXMDeviceType... elements)Adds elements todeviceslist.WXMVirtualMachinebuild()Builds a newWXMVirtualMachine.WXMVirtualMachine.Builderfrom(WXMVirtualMachineType instance)Fill a builder with attribute values from the providedWXMVirtualMachineTypeinstance.WXMVirtualMachine.BuildersetBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Sets or replaces all elements forbootConfigurationslist.WXMVirtualMachine.BuildersetComment(java.lang.String comment)Initializes the value for thecommentattribute.WXMVirtualMachine.BuildersetConfigurationFile(java.net.URI configurationFile)Initializes the optional valueconfigurationFileto configurationFile.WXMVirtualMachine.BuildersetConfigurationFile(java.util.Optional<? extends java.net.URI> configurationFile)Initializes the optional valueconfigurationFileto configurationFile.WXMVirtualMachine.BuildersetCpuTopology(WXMCPUTopology cpuTopology)Initializes the value for thecpuTopologyattribute.WXMVirtualMachine.BuildersetDevices(java.lang.Iterable<? extends WXMDeviceType> elements)Sets or replaces all elements fordeviceslist.WXMVirtualMachine.BuildersetFlags(WXMFlags flags)Initializes the value for theflagsattribute.WXMVirtualMachine.BuildersetId(java.util.UUID id)Initializes the value for theidattribute.WXMVirtualMachine.BuildersetMemory(WXMMemory memory)Initializes the value for thememoryattribute.WXMVirtualMachine.BuildersetName(WXMMachineName name)Initializes the value for thenameattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedWXMVirtualMachineTypeinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
setId
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
setName
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
setComment
Initializes the value for thecommentattribute.If not set, this attribute will have a default value as returned by the initializer of
comment.- Parameters:
comment- The value for comment- Returns:
thisbuilder for use in a chained invocation
-
setCpuTopology
Initializes the value for thecpuTopologyattribute.If not set, this attribute will have a default value as returned by the initializer of
cpuTopology.- Parameters:
cpuTopology- The value for cpuTopology- Returns:
thisbuilder for use in a chained invocation
-
setMemory
Initializes the value for thememoryattribute.If not set, this attribute will have a default value as returned by the initializer of
memory.- Parameters:
memory- The value for memory- Returns:
thisbuilder for use in a chained invocation
-
addDevices
Adds one element todeviceslist.- Parameters:
element- A devices element- Returns:
thisbuilder for use in a chained invocation
-
addDevices
Adds elements todeviceslist.- Parameters:
elements- An array of devices elements- Returns:
thisbuilder for use in a chained invocation
-
setDevices
public final WXMVirtualMachine.Builder setDevices(java.lang.Iterable<? extends WXMDeviceType> elements)Sets or replaces all elements fordeviceslist.- Parameters:
elements- An iterable of devices elements- Returns:
thisbuilder for use in a chained invocation
-
addAllDevices
public final WXMVirtualMachine.Builder addAllDevices(java.lang.Iterable<? extends WXMDeviceType> elements)Adds elements todeviceslist.- Parameters:
elements- An iterable of devices elements- Returns:
thisbuilder for use in a chained invocation
-
setFlags
Initializes the value for theflagsattribute.If not set, this attribute will have a default value as returned by the initializer of
flags.- Parameters:
flags- The value for flags- Returns:
thisbuilder for use in a chained invocation
-
addBootConfigurations
Adds one element tobootConfigurationslist.- Parameters:
element- A bootConfigurations element- Returns:
thisbuilder for use in a chained invocation
-
addBootConfigurations
Adds elements tobootConfigurationslist.- Parameters:
elements- An array of bootConfigurations elements- Returns:
thisbuilder for use in a chained invocation
-
setBootConfigurations
public final WXMVirtualMachine.Builder setBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Sets or replaces all elements forbootConfigurationslist.- Parameters:
elements- An iterable of bootConfigurations elements- Returns:
thisbuilder for use in a chained invocation
-
addAllBootConfigurations
public final WXMVirtualMachine.Builder addAllBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Adds elements tobootConfigurationslist.- Parameters:
elements- An iterable of bootConfigurations elements- Returns:
thisbuilder for use in a chained invocation
-
setConfigurationFile
Initializes the optional valueconfigurationFileto configurationFile.- Parameters:
configurationFile- The value for configurationFile- Returns:
thisbuilder for chained invocation
-
setConfigurationFile
public final WXMVirtualMachine.Builder setConfigurationFile(java.util.Optional<? extends java.net.URI> configurationFile)Initializes the optional valueconfigurationFileto configurationFile.- Parameters:
configurationFile- The value for configurationFile- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newWXMVirtualMachine.- Returns:
- An immutable instance of WXMVirtualMachine
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-