src/main/java/seedu/address/storage/storageFinance/JsonAdaptedFinance.java
public Finance toModelType() throws IllegalValueException {
        final List<Tag> financeTags = new ArrayList<>();
        for (JsonFinanceAdaptedTag tag : tagged) {
            financeTags.add(tag.toModelType());
        }

        if (name == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
        }
        if (!Name.isValidName(name)) {
            throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
        }
        final Name modelName = new Name(name);

        if (financeID == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(financeID)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelId = new ID(financeID);

        if (financeType == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, FinanceType.class.getSimpleName()));
        }
        if (!FinanceType.isValidFinanceType(financeType)) {
            throw new IllegalValueException(FinanceType.MESSAGE_CONSTRAINTS);
        }
        final FinanceType modelFinanceType = new FinanceType(financeType);

        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 (amount == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Finance.class.getSimpleName()));
        }
        if (!Amount.isValidAmount(amount)) {
            throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS);
        }
        final Amount modelAmount = new Amount(amount);

        if (courseid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(courseid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelCourseID = new ID(courseid);

        if (studentid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(studentid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelStudentID = new ID(studentid);

        if (staffid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(staffid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelStaffID = new ID(staffid);

        final Set<Tag> modelTags = new HashSet<>(financeTags);
        return new Finance(modelName, modelId, modelFinanceType, modelDate, modelAmount, modelCourseID, modelStudentID, modelStaffID, modelTags);
    }
/**
     * Converts this Jackson-friendly adapted finance object into the model's {@code Finance} object.
     *
     * @throws IllegalValueException if there were any data constraints violated in the adapted
     *                               finance.
     */
Converts this Jackson-friendly adapted finance object into the model's  Finance object.
@throws IllegalValueException if there were any data constraints violated in the adapted
finance.
Converts this Jackson - friendly adapted finance object into the model ' s Finance object . @throws IllegalValueException if there were any data constraints violated in the adapted finance .
public Finance toModelType() throws IllegalValueException {
        final List<Tag> financeTags = new ArrayList<>();
        for (JsonFinanceAdaptedTag tag : tagged) {
            financeTags.add(tag.toModelType());
        }
        if (name == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
        }
        if (!Name.isValidName(name)) {
            throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
        }
        final Name modelName = new Name(name);
        if (financeID == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(financeID)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelId = new ID(financeID);
        if (financeType == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, FinanceType.class.getSimpleName()));
        }
        if (!FinanceType.isValidFinanceType(financeType)) {
            throw new IllegalValueException(FinanceType.MESSAGE_CONSTRAINTS);
        }
        final FinanceType modelFinanceType = new FinanceType(financeType);
        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 (amount == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Finance.class.getSimpleName()));
        }
        if (!Amount.isValidAmount(amount)) {
            throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS);
        }
        final Amount modelAmount = new Amount(amount);
        if (courseid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(courseid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelCourseID = new ID(courseid);
        if (studentid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(studentid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelStudentID = new ID(studentid);
        if (staffid == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(staffid)) {
            throw new IllegalValueException(ID.MESSAGE_CONSTRAINTS);
        }
        final ID modelStaffID = new ID(staffid);
        final Set<Tag> modelTags = new HashSet<>(financeTags);
        return new Finance(modelName, modelId, modelFinanceType, modelDate, modelAmount, modelCourseID, modelStudentID, modelStaffID, modelTags);
    }
public Finance toModelType ( ) throws IllegalValueException { final List < Tag > financeTags = new ArrayList < > ( ) ; for ( JsonFinanceAdaptedTag tag : tagged ) { financeTags . add ( tag . toModelType ( ) ) ; } if ( name == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Name . class . getSimpleName ( ) ) ) ; } if ( ! Name . isValidName ( name ) ) { throw new IllegalValueException ( Name . MESSAGE_CONSTRAINTS ) ; } final Name modelName = new Name ( name ) ; if ( financeID == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , ID . class . getSimpleName ( ) ) ) ; } if ( ! ID . isValidId ( financeID ) ) { throw new IllegalValueException ( ID . MESSAGE_CONSTRAINTS ) ; } final ID modelId = new ID ( financeID ) ; if ( financeType == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , FinanceType . class . getSimpleName ( ) ) ) ; } if ( ! FinanceType . isValidFinanceType ( financeType ) ) { throw new IllegalValueException ( FinanceType . MESSAGE_CONSTRAINTS ) ; } final FinanceType modelFinanceType = new FinanceType ( financeType ) ; 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 ( amount == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Finance . class . getSimpleName ( ) ) ) ; } if ( ! Amount . isValidAmount ( amount ) ) { throw new IllegalValueException ( Phone . MESSAGE_CONSTRAINTS ) ; } final Amount modelAmount = new Amount ( amount ) ; if ( courseid == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , ID . class . getSimpleName ( ) ) ) ; } if ( ! ID . isValidId ( courseid ) ) { throw new IllegalValueException ( ID . MESSAGE_CONSTRAINTS ) ; } final ID modelCourseID = new ID ( courseid ) ; if ( studentid == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , ID . class . getSimpleName ( ) ) ) ; } if ( ! ID . isValidId ( studentid ) ) { throw new IllegalValueException ( ID . MESSAGE_CONSTRAINTS ) ; } final ID modelStudentID = new ID ( studentid ) ; if ( staffid == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , ID . class . getSimpleName ( ) ) ) ; } if ( ! ID . isValidId ( staffid ) ) { throw new IllegalValueException ( ID . MESSAGE_CONSTRAINTS ) ; } final ID modelStaffID = new ID ( staffid ) ; final Set < Tag > modelTags = new HashSet < > ( financeTags ) ; return new Finance ( modelName , modelId , modelFinanceType , modelDate , modelAmount , modelCourseID , modelStudentID , modelStaffID , modelTags ) ; }
Converts this Jackson-friendly adapted finance object into the model's {@code Finance} object.
Converts this Jackson - friendly adapted finance object into the model ' s { @code Finance } object .