Package com.io7m.waxmill.machines
Class WXMVirtualMachine
java.lang.Object
com.io7m.waxmill.machines.WXMVirtualMachine
- All Implemented Interfaces:
WXMVirtualMachineType
public final class WXMVirtualMachine extends java.lang.Object implements WXMVirtualMachineType
A virtual machine.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWXMVirtualMachine.BuilderBuilds instances of typeWXMVirtualMachine. -
Method Summary
Modifier and Type Method Description java.util.Map<WXMBootConfigurationName,WXMBootConfigurationType>bootConfigurationMap()java.util.List<WXMBootConfigurationType>bootConfigurations()static WXMVirtualMachine.Builderbuilder()Creates a builder forWXMVirtualMachine.java.lang.Stringcomment()java.util.Optional<java.net.URI>configurationFile()static WXMVirtualMachinecopyOf(WXMVirtualMachineType instance)Creates an immutable copy of aWXMVirtualMachineTypevalue.WXMCPUTopologycpuTopology()java.util.Map<WXMDeviceSlot,WXMDeviceType>deviceMap()java.util.List<WXMDeviceType>devices()booleanequals(java.lang.Object another)This instance is equal to all instances ofWXMVirtualMachinethat have equal attribute values.WXMFlagsflags()inthashCode()Computes a hash code from attributes:id,name,comment,cpuTopology,memory,devices,flags,bootConfigurations,configurationFile.java.util.UUIDid()WXMMemorymemory()WXMMachineNamename()java.lang.StringtoString()Prints the immutable valueWXMVirtualMachinewith attribute values.WXMVirtualMachinewithBootConfigurations(WXMBootConfigurationType... elements)Copy the current immutable object with elements that replace the content ofbootConfigurations.WXMVirtualMachinewithBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Copy the current immutable object with elements that replace the content ofbootConfigurations.WXMVirtualMachinewithComment(java.lang.String value)Copy the current immutable object by setting a value for thecommentattribute.WXMVirtualMachinewithConfigurationFile(java.net.URI value)Copy the current immutable object by setting a present value for the optionalconfigurationFileattribute.WXMVirtualMachinewithConfigurationFile(java.util.Optional<? extends java.net.URI> optional)Copy the current immutable object by setting an optional value for theconfigurationFileattribute.WXMVirtualMachinewithCpuTopology(WXMCPUTopology value)Copy the current immutable object by setting a value for thecpuTopologyattribute.WXMVirtualMachinewithDevices(WXMDeviceType... elements)Copy the current immutable object with elements that replace the content ofdevices.WXMVirtualMachinewithDevices(java.lang.Iterable<? extends WXMDeviceType> elements)Copy the current immutable object with elements that replace the content ofdevices.WXMVirtualMachinewithFlags(WXMFlags value)Copy the current immutable object by setting a value for theflagsattribute.WXMVirtualMachinewithId(java.util.UUID value)Copy the current immutable object by setting a value for theidattribute.WXMVirtualMachinewithMemory(WXMMemory value)Copy the current immutable object by setting a value for thememoryattribute.WXMVirtualMachinewithName(WXMMachineName value)Copy the current immutable object by setting a value for thenameattribute.
-
Method Details
-
id
public java.util.UUID id()- Specified by:
idin interfaceWXMVirtualMachineType- Returns:
- The machine ID
-
name
- Specified by:
namein interfaceWXMVirtualMachineType- Returns:
- The machine name
-
comment
public java.lang.String comment()- Specified by:
commentin interfaceWXMVirtualMachineType- Returns:
- A descriptive comment
-
cpuTopology
- Specified by:
cpuTopologyin interfaceWXMVirtualMachineType- Returns:
- The CPU topology
-
memory
- Specified by:
memoryin interfaceWXMVirtualMachineType- Returns:
- The machine's memory configuration
-
devices
- Specified by:
devicesin interfaceWXMVirtualMachineType- Returns:
- The list of devices attached to the machine
-
flags
- Specified by:
flagsin interfaceWXMVirtualMachineType- Returns:
- The machine flags
-
bootConfigurations
- Specified by:
bootConfigurationsin interfaceWXMVirtualMachineType- Returns:
- The list of boot configurations associated with the machine
-
configurationFile
public java.util.Optional<java.net.URI> configurationFile()- Specified by:
configurationFilein interfaceWXMVirtualMachineType- Returns:
- The configuration file path, if the VM was configured from a file
-
deviceMap
- Specified by:
deviceMapin interfaceWXMVirtualMachineType- Returns:
- The set of attached devices, ordered by device slot
-
bootConfigurationMap
- Specified by:
bootConfigurationMapin interfaceWXMVirtualMachineType- Returns:
- The set of boot configurations, ordered by name
-
withId
Copy the current immutable object by setting a value for theidattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for id- Returns:
- A modified copy of the
thisobject
-
withName
Copy the current immutable object by setting a value for thenameattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withComment
Copy the current immutable object by setting a value for thecommentattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for comment- Returns:
- A modified copy of the
thisobject
-
withCpuTopology
Copy the current immutable object by setting a value for thecpuTopologyattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for cpuTopology- Returns:
- A modified copy of the
thisobject
-
withMemory
Copy the current immutable object by setting a value for thememoryattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for memory- Returns:
- A modified copy of the
thisobject
-
withDevices
Copy the current immutable object with elements that replace the content ofdevices.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withDevices
Copy the current immutable object with elements that replace the content ofdevices. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of devices elements to set- Returns:
- A modified copy of
thisobject
-
withFlags
Copy the current immutable object by setting a value for theflagsattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for flags- Returns:
- A modified copy of the
thisobject
-
withBootConfigurations
Copy the current immutable object with elements that replace the content ofbootConfigurations.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withBootConfigurations
public final WXMVirtualMachine withBootConfigurations(java.lang.Iterable<? extends WXMBootConfigurationType> elements)Copy the current immutable object with elements that replace the content ofbootConfigurations. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of bootConfigurations elements to set- Returns:
- A modified copy of
thisobject
-
withConfigurationFile
Copy the current immutable object by setting a present value for the optionalconfigurationFileattribute.- Parameters:
value- The value for configurationFile- Returns:
- A modified copy of
thisobject
-
withConfigurationFile
public final WXMVirtualMachine withConfigurationFile(java.util.Optional<? extends java.net.URI> optional)Copy the current immutable object by setting an optional value for theconfigurationFileattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for configurationFile- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofWXMVirtualMachinethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:id,name,comment,cpuTopology,memory,devices,flags,bootConfigurations,configurationFile.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueWXMVirtualMachinewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aWXMVirtualMachineTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable WXMVirtualMachine instance
-
builder
Creates a builder forWXMVirtualMachine.WXMVirtualMachine.builder() .setId(UUID) // requiredid.setName(com.io7m.waxmill.machines.WXMMachineName) // requiredname.setComment(String) // optionalcomment.setCpuTopology(com.io7m.waxmill.machines.WXMCPUTopology) // optionalcpuTopology.setMemory(com.io7m.waxmill.machines.WXMMemory) // optionalmemory.addDevices|addAllDevices(com.io7m.waxmill.machines.WXMDeviceType) //deviceselements .setFlags(com.io7m.waxmill.machines.WXMFlags) // optionalflags.addBootConfigurations|addAllBootConfigurations(com.io7m.waxmill.machines.WXMBootConfigurationType) //bootConfigurationselements .setConfigurationFile(java.net.URI) // optionalconfigurationFile.build();- Returns:
- A new WXMVirtualMachine builder
-