private static void copyInternal(Composable source, Composed target, BeanWrapper parent) { // copy(source, target); if (target instanceof Mixture) { Mixture mixture = (Mixture) target; String totalPropName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, mixture.getSubstanceName() + "Total"); if (parent.isReadableProperty(totalPropName) && parent.getPropertyType(totalPropName) == Double.class) { Double total = (Double) parent.getPropertyValue(totalPropName); if (total != null) { if (mixture.isComplete()) { double t = mixture.getAmount(); mixture.setRemains(Math.max(total - t, 0.0)); } else { mixture.setAmount(total); } } } } }