public SimpleQuantity copy() { SimpleQuantity dst = new SimpleQuantity(); copyValues(dst); dst.value = value == null ? null : value.copy(); dst.comparator = comparator == null ? null : comparator.copy(); dst.unit = unit == null ? null : unit.copy(); dst.system = system == null ? null : system.copy(); dst.code = code == null ? null : code.copy(); return dst; }
public SimpleQuantity castToSimpleQuantity(Base b) throws FHIRException { if (b instanceof SimpleQuantity) return (SimpleQuantity) b; else if (b instanceof Quantity) { Quantity q = (Quantity) b; SimpleQuantity sq = new SimpleQuantity(); sq.setValueElement(q.getValueElement()); sq.setComparatorElement(q.getComparatorElement()); sq.setUnitElement(q.getUnitElement()); sq.setSystemElement(q.getSystemElement()); sq.setCodeElement(q.getCodeElement()); return sq; } else throw new FHIRException( "Unable to convert a " + b.getClass().getName() + " to an SimpleQuantity"); }