src/main/java/seedu/insurancepal/logic/parser/AddCommandParser.java
/**
     * Parses the given {@code String} of arguments in the context of the AddCommand
     * and returns an AddCommand object for execution.
     * @throws ParseException if the user input does not conform the expected format
     */
Parses the given  String of arguments in the context of the AddCommand
and returns an AddCommand object for execution.
@throws ParseException if the user input does not conform the expected format
Parses the given String of arguments in the context of the AddCommand and returns an AddCommand object for execution . @throws ParseException if the user input does not conform the expected format
public AddCommand parse(String args) throws ParseException {
        ArgumentMultimap argMultimap =
                ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS,
                        PREFIX_TAG, PREFIX_INSURANCE, PREFIX_NOTE);
        if (!argMultimap.arePrefixesPresent(PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL)
                || !argMultimap.getPreamble().isEmpty()) {
            throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
        }
        Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
        Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
        Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
        Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
        Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
        Set<Insurance> insuranceList = ParserUtil.parseInsurances(argMultimap.getAllValues(PREFIX_INSURANCE));
        Note note = ParserUtil.parseNote(argMultimap.getValue(PREFIX_NOTE).orElse(""));
        Person person = new Person(name, phone, email, address, tagList, insuranceList,
                note, new Appointment(""), new HashSet<>());
        return new AddCommand(person);
    }
public AddCommand parse ( String args ) throws ParseException { ArgumentMultimap argMultimap = ArgumentTokenizer . tokenize ( args , PREFIX_NAME , PREFIX_PHONE , PREFIX_EMAIL , PREFIX_ADDRESS , PREFIX_TAG , PREFIX_INSURANCE , PREFIX_NOTE ) ; if ( ! argMultimap . arePrefixesPresent ( PREFIX_NAME , PREFIX_ADDRESS , PREFIX_PHONE , PREFIX_EMAIL ) || ! argMultimap . getPreamble ( ) . isEmpty ( ) ) { throw new ParseException ( String . format ( MESSAGE_INVALID_COMMAND_FORMAT , AddCommand . MESSAGE_USAGE ) ) ; } Name name = ParserUtil . parseName ( argMultimap . getValue ( PREFIX_NAME ) . get ( ) ) ; Phone phone = ParserUtil . parsePhone ( argMultimap . getValue ( PREFIX_PHONE ) . get ( ) ) ; Email email = ParserUtil . parseEmail ( argMultimap . getValue ( PREFIX_EMAIL ) . get ( ) ) ; Address address = ParserUtil . parseAddress ( argMultimap . getValue ( PREFIX_ADDRESS ) . get ( ) ) ; Set < Tag > tagList = ParserUtil . parseTags ( argMultimap . getAllValues ( PREFIX_TAG ) ) ; Set < Insurance > insuranceList = ParserUtil . parseInsurances ( argMultimap . getAllValues ( PREFIX_INSURANCE ) ) ; Note note = ParserUtil . parseNote ( argMultimap . getValue ( PREFIX_NOTE ) . orElse ( "" ) ) ; Person person = new Person ( name , phone , email , address , tagList , insuranceList , note , new Appointment ( "" ) , new HashSet < > ( ) ) ; return new AddCommand ( person ) ; }
Parses the given {@code String} of arguments in the context of the AddCommand
 and returns an AddCommand object for execution.
Parses the given { @code String } of arguments in the context of the AddCommand and returns an AddCommand object for execution .