src/main/java/seedu/address/storage/JsonAdaptedDay.java
/**
     * Converts this Jackson-friendly adapted day object into the model's {@code Day} object.
     *
     * @throws IllegalValueException if there were any data constraints violated in the adapted day.
     */
Converts this Jackson-friendly adapted day object into the model's  Day object.
@throws IllegalValueException if there were any data constraints violated in the adapted day.
Converts this Jackson - friendly adapted day object into the model ' s Day object . @throws IllegalValueException if there were any data constraints violated in the adapted day .
public Day toModelType() throws IllegalValueException {
        if (date == null) {
            throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Date.class.getSimpleName()));
        }
        if (!Date.isValidDate(date)) {
            throw new IllegalValueException(Date.MESSAGE_CONSTRAINTS);
        }
        final Date modelDate = new Date(date);
        if (weight == null) {
            throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Weight.class.getSimpleName()));
        }
        if (!Weight.isValidWeight(weight)) {
            throw new IllegalValueException(Weight.MESSAGE_CONSTRAINTS);
        }
        final Weight modelWeight = new Weight(weight);
        if (calorieManager == null) {
            throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT,
                    CalorieManager.class.getSimpleName()));
        }
        final CalorieManager modelCalorieManager = calorieManager.toModelType();
        return new Day(modelDate, modelWeight, modelCalorieManager);
    }
public Day toModelType ( ) throws IllegalValueException { if ( date == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Date . class . getSimpleName ( ) ) ) ; } if ( ! Date . isValidDate ( date ) ) { throw new IllegalValueException ( Date . MESSAGE_CONSTRAINTS ) ; } final Date modelDate = new Date ( date ) ; if ( weight == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Weight . class . getSimpleName ( ) ) ) ; } if ( ! Weight . isValidWeight ( weight ) ) { throw new IllegalValueException ( Weight . MESSAGE_CONSTRAINTS ) ; } final Weight modelWeight = new Weight ( weight ) ; if ( calorieManager == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , CalorieManager . class . getSimpleName ( ) ) ) ; } final CalorieManager modelCalorieManager = calorieManager . toModelType ( ) ; return new Day ( modelDate , modelWeight , modelCalorieManager ) ; }
Converts this Jackson-friendly adapted day object into the model's {@code Day} object.
Converts this Jackson - friendly adapted day object into the model ' s { @code Day } object .