Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / core / src / net / sf / openrocket / preset / xml / TubeCouplerDTO.java
diff --git a/core/src/net/sf/openrocket/preset/xml/TubeCouplerDTO.java b/core/src/net/sf/openrocket/preset/xml/TubeCouplerDTO.java
new file mode 100644 (file)
index 0000000..3cc0965
--- /dev/null
@@ -0,0 +1,40 @@
+
+package net.sf.openrocket.preset.xml;
+
+import net.sf.openrocket.preset.ComponentPreset;
+import net.sf.openrocket.preset.InvalidComponentPresetException;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+/**
+ * Tube coupler preset XML handler.
+ */
+@XmlRootElement(name = "TubeCoupler")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class TubeCouplerDTO extends BodyTubeDTO {
+
+    /**
+     * Default constructor.
+     */
+    public TubeCouplerDTO() {
+    }
+
+    /**
+     * Most-useful constructor that maps a TubeCoupler preset to a TubeCouplerDTO.
+     *
+     * @param thePreset  the preset
+     *
+     * @throws net.sf.openrocket.util.BugException thrown if the expected tube coupler keys are not in the preset
+     */
+    public TubeCouplerDTO(ComponentPreset thePreset) {
+        super(thePreset);
+    }
+
+    @Override
+    public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
+        return super.asComponentPreset(ComponentPreset.Type.TUBE_COUPLER, materials);
+    }
+}