@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.Pressure) { ome.model.units.Pressure t = (ome.model.units.Pressure) model; this.value = t.getValue(); this.unit = UnitsPressure.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "Pressure cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }
/** * FIXME: this should likely take a default so that locations which don't * want an exception can have * * log.warn("Using new PositiveFloat(1.0)!", e); return new * PositiveFloat(1.0); * * or similar. */ public static ome.units.quantity.Pressure convertPressure(Pressure t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsPressure units = makePressureUnitXML(u); ome.units.unit.Unit<ome.units.quantity.Pressure> units2 = ome.xml.model.enums.handlers.UnitsPressureEnumHandler .getBaseUnit(units); return new ome.units.quantity.Pressure(v, units2); }