public static Power convertPower(Power value, Unit<ome.units.quantity.Power> ul) { return convertPower(value, ul.getSymbol()); }
/** * 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.Power convertPower(Power t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsPower units = makePowerUnitXML(u); ome.units.unit.Unit<ome.units.quantity.Power> units2 = ome.xml.model.enums.handlers.UnitsPowerEnumHandler .getBaseUnit(units); return new ome.units.quantity.Power(v, units2); }
public static ome.units.quantity.Power makePowerXML(double d, String unit) { ome.units.unit.Unit<ome.units.quantity.Power> units = ome.xml.model.enums.handlers.UnitsPowerEnumHandler .getBaseUnit(makePowerUnitXML(unit)); return new ome.units.quantity.Power(d, units); }
@Override public Filterable fillObject(ReverseModelMapper mapper) { ome.model.enums.UnitsPower ut = ome.model.enums.UnitsPower.valueOf(getUnit().toString()); ome.model.units.Power t = new ome.model.units.Power(getValue(), ut); return t; }
@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.Power) { ome.model.units.Power t = (ome.model.units.Power) model; this.value = t.getValue(); this.unit = UnitsPower.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "Power cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }