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.
  • Method Details

    • id

      public java.util.UUID id()
      Specified by:
      id in interface WXMVirtualMachineType
      Returns:
      The machine ID
    • name

      public WXMMachineName name()
      Specified by:
      name in interface WXMVirtualMachineType
      Returns:
      The machine name
    • comment

      public java.lang.String comment()
      Specified by:
      comment in interface WXMVirtualMachineType
      Returns:
      A descriptive comment
    • cpuTopology

      public WXMCPUTopology cpuTopology()
      Specified by:
      cpuTopology in interface WXMVirtualMachineType
      Returns:
      The CPU topology
    • memory

      public WXMMemory memory()
      Specified by:
      memory in interface WXMVirtualMachineType
      Returns:
      The machine's memory configuration
    • devices

      public java.util.List<WXMDeviceType> devices()
      Specified by:
      devices in interface WXMVirtualMachineType
      Returns:
      The list of devices attached to the machine
    • flags

      public WXMFlags flags()
      Specified by:
      flags in interface WXMVirtualMachineType
      Returns:
      The machine flags
    • bootConfigurations

      public java.util.List<WXMBootConfigurationType> bootConfigurations()
      Specified by:
      bootConfigurations in interface WXMVirtualMachineType
      Returns:
      The list of boot configurations associated with the machine
    • configurationFile

      public java.util.Optional<java.net.URI> configurationFile()
      Specified by:
      configurationFile in interface WXMVirtualMachineType
      Returns:
      The configuration file path, if the VM was configured from a file
    • deviceMap

      public java.util.Map<WXMDeviceSlot,​WXMDeviceType> deviceMap()
      Specified by:
      deviceMap in interface WXMVirtualMachineType
      Returns:
      The set of attached devices, ordered by device slot
    • bootConfigurationMap

      public java.util.Map<WXMBootConfigurationName,​WXMBootConfigurationType> bootConfigurationMap()
      Specified by:
      bootConfigurationMap in interface WXMVirtualMachineType
      Returns:
      The set of boot configurations, ordered by name
    • withId

      public final WXMVirtualMachine withId​(java.util.UUID value)
      Copy the current immutable object by setting a value for the id attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for id
      Returns:
      A modified copy of the this object
    • withName

      public final WXMVirtualMachine withName​(WXMMachineName value)
      Copy the current immutable object by setting a value for the name attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withComment

      public final WXMVirtualMachine withComment​(java.lang.String value)
      Copy the current immutable object by setting a value for the comment attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for comment
      Returns:
      A modified copy of the this object
    • withCpuTopology

      public final WXMVirtualMachine withCpuTopology​(WXMCPUTopology value)
      Copy the current immutable object by setting a value for the cpuTopology attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for cpuTopology
      Returns:
      A modified copy of the this object
    • withMemory

      public final WXMVirtualMachine withMemory​(WXMMemory value)
      Copy the current immutable object by setting a value for the memory attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for memory
      Returns:
      A modified copy of the this object
    • withDevices

      public final WXMVirtualMachine withDevices​(WXMDeviceType... elements)
      Copy the current immutable object with elements that replace the content of devices.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withDevices

      public final WXMVirtualMachine withDevices​(java.lang.Iterable<? extends WXMDeviceType> elements)
      Copy the current immutable object with elements that replace the content of devices. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of devices elements to set
      Returns:
      A modified copy of this object
    • withFlags

      public final WXMVirtualMachine withFlags​(WXMFlags value)
      Copy the current immutable object by setting a value for the flags attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for flags
      Returns:
      A modified copy of the this object
    • withBootConfigurations

      public final WXMVirtualMachine withBootConfigurations​(WXMBootConfigurationType... elements)
      Copy the current immutable object with elements that replace the content of bootConfigurations.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withBootConfigurations

      public final WXMVirtualMachine withBootConfigurations​(java.lang.Iterable<? extends WXMBootConfigurationType> elements)
      Copy the current immutable object with elements that replace the content of bootConfigurations. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of bootConfigurations elements to set
      Returns:
      A modified copy of this object
    • withConfigurationFile

      public final WXMVirtualMachine withConfigurationFile​(java.net.URI value)
      Copy the current immutable object by setting a present value for the optional configurationFile attribute.
      Parameters:
      value - The value for configurationFile
      Returns:
      A modified copy of this object
    • withConfigurationFile

      public final WXMVirtualMachine withConfigurationFile​(java.util.Optional<? extends java.net.URI> optional)
      Copy the current immutable object by setting an optional value for the configurationFile attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for configurationFile
      Returns:
      A modified copy of this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of WXMVirtualMachine that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: id, name, comment, cpuTopology, memory, devices, flags, bootConfigurations, configurationFile.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value WXMVirtualMachine with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      public static WXMVirtualMachine copyOf​(WXMVirtualMachineType instance)
      Creates an immutable copy of a WXMVirtualMachineType value. 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

      public static WXMVirtualMachine.Builder builder()
      Creates a builder for WXMVirtualMachine.
       WXMVirtualMachine.builder()
          .setId(UUID) // required id
          .setName(com.io7m.waxmill.machines.WXMMachineName) // required name
          .setComment(String) // optional comment
          .setCpuTopology(com.io7m.waxmill.machines.WXMCPUTopology) // optional cpuTopology
          .setMemory(com.io7m.waxmill.machines.WXMMemory) // optional memory
          .addDevices|addAllDevices(com.io7m.waxmill.machines.WXMDeviceType) // devices elements
          .setFlags(com.io7m.waxmill.machines.WXMFlags) // optional flags
          .addBootConfigurations|addAllBootConfigurations(com.io7m.waxmill.machines.WXMBootConfigurationType) // bootConfigurations elements
          .setConfigurationFile(java.net.URI) // optional configurationFile
          .build();
       
      Returns:
      A new WXMVirtualMachine builder