2 package net.sf.openrocket.preset.xml;
4 import net.sf.openrocket.preset.ComponentPreset;
6 import javax.xml.bind.annotation.XmlAccessType;
7 import javax.xml.bind.annotation.XmlAccessorType;
8 import javax.xml.bind.annotation.XmlElement;
11 * Base class for the external representation of all component presets.
13 @XmlAccessorType(XmlAccessType.FIELD)
14 public abstract class BaseComponentDTO {
16 @XmlElement(name = "Manufacturer")
17 private String manufacturer;
18 @XmlElement(name = "PartNumber")
19 private String partNo;
20 @XmlElement(name = "Description")
21 private String description;
22 @XmlElement(name = "Material")
23 private String material;
24 @XmlElement(name = "Mass")
28 * Default constructor.
30 protected BaseComponentDTO() {
36 * @param preset the preset to use to pull data values out of
38 * @throws net.sf.openrocket.util.BugException thrown if the expected body tube keys are not in the preset
40 protected BaseComponentDTO(final ComponentPreset preset) {
41 setManufacturer(preset.getManufacturer().getSimpleName());
42 setPartNo(preset.getPartNo());
43 setDescription(preset.get(ComponentPreset.DESCRIPTION));
44 setMaterial(preset.get(ComponentPreset.MATERIAL).getName());
45 if (preset.has(ComponentPreset.MASS)) {
46 setMass(preset.get(ComponentPreset.MASS));
50 public String getManufacturer() {
54 public void setManufacturer(final String theManufacturer) {
55 manufacturer = theManufacturer;
58 public String getPartNo() {
62 public void setPartNo(final String thePartNo) {
66 public String getDescription() {
70 public void setDescription(final String theDescription) {
71 description = theDescription;
74 public String getMaterial() {
78 public void setMaterial(final String theMaterial) {
79 material = theMaterial;
82 public double getMass() {
86 public void setMass(final double theMass) {