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"); }
private void checkQuantity(List<ValidationMessage> errors, String path, WrapperElement focus, Quantity fixed) { checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator"); checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units"); checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); }
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"); }
private void checkQuantity(List<ValidationMessage> errors, String path, WrapperElement focus, Quantity fixed) { checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator"); checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units"); checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); }