class NumberFieldActions implements AtlasFieldAction {

    @AtlasActionProcessor
    public static Number convertDistanceUnit(ConvertDistanceUnit convertDistanceUnit, Number input) {
        if (input == null) {
            return 0;
        }

        if (convertDistanceUnit == null || convertDistanceUnit.getFromUnit() == null
                || convertDistanceUnit.getToUnit() == null) {
            throw new IllegalArgumentException("ConvertDistanceUnit must be specified  with fromUnit and toUnit");
        }

        DistanceUnitType fromUnit = convertDistanceUnit.getFromUnit();
        DistanceUnitType toUnit = convertDistanceUnit.getToUnit();
        double rate = distanceConvertionTable.get(fromUnit).get(toUnit);
        return doMultiply(input, rate);
    }

}