+ * This is the full string that would be used by a user to input a flag. + * This means it's the concatenated result of prefix, name, postfix together. + *
+ * + * @return The string representation of this flag. + */ + @Override + public String toString() { + return this.getPrefix() + this.getName() + this.getPostfix(); + } + + @Override + public int hashCode() { + return name == null ? 0 : name.hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof Flag)) { + return false; + } + + Flag otherFlag = (Flag) other; + return Objects.equals(name, otherFlag.name) + && Objects.equals(prefix, otherFlag.prefix) + && Objects.equals(postfix, otherFlag.postfix); + } +} diff --git a/src/main/java/seedu/address/logic/parser/Prefix.java b/src/main/java/seedu/address/logic/parser/Prefix.java deleted file mode 100644 index 348b7686c8a..00000000000 --- a/src/main/java/seedu/address/logic/parser/Prefix.java +++ /dev/null @@ -1,42 +0,0 @@ -package seedu.address.logic.parser; - -/** - * A prefix that marks the beginning of an argument in an arguments string. - * E.g. 't/' in 'add James t/ friend'. - */ -public class Prefix { - private final String prefix; - - public Prefix(String prefix) { - this.prefix = prefix; - } - - public String getPrefix() { - return prefix; - } - - @Override - public String toString() { - return getPrefix(); - } - - @Override - public int hashCode() { - return prefix == null ? 0 : prefix.hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof Prefix)) { - return false; - } - - Prefix otherPrefix = (Prefix) other; - return prefix.equals(otherPrefix.prefix); - } -} diff --git a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java index a3fd2b3dc9e..e0f1406122d 100644 --- a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java +++ b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java @@ -2,11 +2,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.FLAG_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.FLAG_EMAIL; +import static seedu.address.logic.parser.CliSyntax.FLAG_NAME; +import static seedu.address.logic.parser.CliSyntax.FLAG_PHONE; +import static seedu.address.logic.parser.CliSyntax.FLAG_TAG; import static seedu.address.testutil.Assert.assertThrows; import java.util.ArrayList; @@ -37,22 +37,22 @@ public class CommandTestUtil { public static final String VALID_TAG_HUSBAND = "husband"; public static final String VALID_TAG_FRIEND = "friend"; - public static final String NAME_DESC_AMY = " " + PREFIX_NAME + VALID_NAME_AMY; - public static final String NAME_DESC_BOB = " " + PREFIX_NAME + VALID_NAME_BOB; - public static final String PHONE_DESC_AMY = " " + PREFIX_PHONE + VALID_PHONE_AMY; - public static final String PHONE_DESC_BOB = " " + PREFIX_PHONE + VALID_PHONE_BOB; - public static final String EMAIL_DESC_AMY = " " + PREFIX_EMAIL + VALID_EMAIL_AMY; - public static final String EMAIL_DESC_BOB = " " + PREFIX_EMAIL + VALID_EMAIL_BOB; - public static final String ADDRESS_DESC_AMY = " " + PREFIX_ADDRESS + VALID_ADDRESS_AMY; - public static final String ADDRESS_DESC_BOB = " " + PREFIX_ADDRESS + VALID_ADDRESS_BOB; - public static final String TAG_DESC_FRIEND = " " + PREFIX_TAG + VALID_TAG_FRIEND; - public static final String TAG_DESC_HUSBAND = " " + PREFIX_TAG + VALID_TAG_HUSBAND; - - public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + "James&"; // '&' not allowed in names - public static final String INVALID_PHONE_DESC = " " + PREFIX_PHONE + "911a"; // 'a' not allowed in phones - public static final String INVALID_EMAIL_DESC = " " + PREFIX_EMAIL + "bob!yahoo"; // missing '@' symbol - public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS; // empty string not allowed for addresses - public static final String INVALID_TAG_DESC = " " + PREFIX_TAG + "hubby*"; // '*' not allowed in tags + public static final String NAME_DESC_AMY = " " + FLAG_NAME + VALID_NAME_AMY; + public static final String NAME_DESC_BOB = " " + FLAG_NAME + VALID_NAME_BOB; + public static final String PHONE_DESC_AMY = " " + FLAG_PHONE + VALID_PHONE_AMY; + public static final String PHONE_DESC_BOB = " " + FLAG_PHONE + VALID_PHONE_BOB; + public static final String EMAIL_DESC_AMY = " " + FLAG_EMAIL + VALID_EMAIL_AMY; + public static final String EMAIL_DESC_BOB = " " + FLAG_EMAIL + VALID_EMAIL_BOB; + public static final String ADDRESS_DESC_AMY = " " + FLAG_ADDRESS + VALID_ADDRESS_AMY; + public static final String ADDRESS_DESC_BOB = " " + FLAG_ADDRESS + VALID_ADDRESS_BOB; + public static final String TAG_DESC_FRIEND = " " + FLAG_TAG + VALID_TAG_FRIEND; + public static final String TAG_DESC_HUSBAND = " " + FLAG_TAG + VALID_TAG_HUSBAND; + + public static final String INVALID_NAME_DESC = " " + FLAG_NAME + "James&"; // '&' not allowed in names + public static final String INVALID_PHONE_DESC = " " + FLAG_PHONE + "911a"; // 'a' not allowed in phones + public static final String INVALID_EMAIL_DESC = " " + FLAG_EMAIL + "bob!yahoo"; // missing '@' symbol + public static final String INVALID_ADDRESS_DESC = " " + FLAG_ADDRESS; // empty string not allowed for addresses + public static final String INVALID_TAG_DESC = " " + FLAG_TAG + "hubby*"; // '*' not allowed in tags public static final String PREAMBLE_WHITESPACE = "\t \r \n"; public static final String PREAMBLE_NON_EMPTY = "NonEmptyPreamble"; diff --git a/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java b/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java index bc4792f5ed2..6b20639266a 100644 --- a/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java @@ -24,10 +24,10 @@ import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_FRIEND; import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_HUSBAND; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.FLAG_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.FLAG_EMAIL; +import static seedu.address.logic.parser.CliSyntax.FLAG_NAME; +import static seedu.address.logic.parser.CliSyntax.FLAG_PHONE; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; import static seedu.address.testutil.TypicalContacts.AMY; @@ -72,61 +72,61 @@ public void parse_repeatedNonTagValue_failure() { // multiple names assertParseFailure(parser, NAME_DESC_AMY + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME)); + Messages.getErrorMessageForDuplicateFlags(FLAG_NAME)); // multiple phones assertParseFailure(parser, PHONE_DESC_AMY + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); + Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE)); // multiple emails assertParseFailure(parser, EMAIL_DESC_AMY + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_EMAIL)); + Messages.getErrorMessageForDuplicateFlags(FLAG_EMAIL)); // multiple addresses assertParseFailure(parser, ADDRESS_DESC_AMY + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_ADDRESS)); + Messages.getErrorMessageForDuplicateFlags(FLAG_ADDRESS)); // multiple fields repeated assertParseFailure(parser, validExpectedContactString + PHONE_DESC_AMY + EMAIL_DESC_AMY + NAME_DESC_AMY + ADDRESS_DESC_AMY + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME, PREFIX_ADDRESS, PREFIX_EMAIL, PREFIX_PHONE)); + Messages.getErrorMessageForDuplicateFlags(FLAG_NAME, FLAG_ADDRESS, FLAG_EMAIL, FLAG_PHONE)); // invalid value followed by valid value // invalid name assertParseFailure(parser, INVALID_NAME_DESC + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME)); + Messages.getErrorMessageForDuplicateFlags(FLAG_NAME)); // invalid email assertParseFailure(parser, INVALID_EMAIL_DESC + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_EMAIL)); + Messages.getErrorMessageForDuplicateFlags(FLAG_EMAIL)); // invalid phone assertParseFailure(parser, INVALID_PHONE_DESC + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); + Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE)); // invalid address assertParseFailure(parser, INVALID_ADDRESS_DESC + validExpectedContactString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_ADDRESS)); + Messages.getErrorMessageForDuplicateFlags(FLAG_ADDRESS)); // valid value followed by invalid value // invalid name assertParseFailure(parser, validExpectedContactString + INVALID_NAME_DESC, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME)); + Messages.getErrorMessageForDuplicateFlags(FLAG_NAME)); // invalid email assertParseFailure(parser, validExpectedContactString + INVALID_EMAIL_DESC, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_EMAIL)); + Messages.getErrorMessageForDuplicateFlags(FLAG_EMAIL)); // invalid phone assertParseFailure(parser, validExpectedContactString + INVALID_PHONE_DESC, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); + Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE)); // invalid address assertParseFailure(parser, validExpectedContactString + INVALID_ADDRESS_DESC, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_ADDRESS)); + Messages.getErrorMessageForDuplicateFlags(FLAG_ADDRESS)); } @Test @@ -141,23 +141,23 @@ public void parse_optionalFieldsMissing_success() { public void parse_compulsoryFieldMissing_failure() { String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE); - // missing name prefix + // missing name flag assertParseFailure(parser, VALID_NAME_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB, expectedMessage); - // missing phone prefix + // missing phone flag assertParseFailure(parser, NAME_DESC_BOB + VALID_PHONE_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB, expectedMessage); - // missing email prefix + // missing email flag assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + VALID_EMAIL_BOB + ADDRESS_DESC_BOB, expectedMessage); - // missing address prefix + // missing address flag assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + VALID_ADDRESS_BOB, expectedMessage); - // all prefixes missing + // all flags missing assertParseFailure(parser, VALID_NAME_BOB + VALID_PHONE_BOB + VALID_EMAIL_BOB + VALID_ADDRESS_BOB, expectedMessage); } diff --git a/src/test/java/seedu/address/logic/parser/ArgumentTokenizerTest.java b/src/test/java/seedu/address/logic/parser/ArgumentTokenizerTest.java index c97308935f5..5b750d413e2 100644 --- a/src/test/java/seedu/address/logic/parser/ArgumentTokenizerTest.java +++ b/src/test/java/seedu/address/logic/parser/ArgumentTokenizerTest.java @@ -9,10 +9,10 @@ public class ArgumentTokenizerTest { - private final Prefix unknownPrefix = new Prefix("--u"); - private final Prefix pSlash = new Prefix("p/"); - private final Prefix dashT = new Prefix("-t"); - private final Prefix hatQ = new Prefix("^Q"); + private final Flag unknownFlag = new Flag("u", "--", null); + private final Flag pSlash = new Flag("p", null, "/"); + private final Flag dashT = new Flag("t", "-", null); + private final Flag hatQ = new Flag("Q", "^", null); @Test public void tokenize_emptyArgsString_noValues() { @@ -32,29 +32,29 @@ private void assertPreambleEmpty(ArgumentMultimap argMultimap) { } /** - * Asserts all the arguments in {@code argMultimap} with {@code prefix} match the {@code expectedValues} + * Asserts all the arguments in {@code argMultimap} with {@code flag} match the {@code expectedValues} * and only the last value is returned upon calling {@code ArgumentMultimap#getValue(Prefix)}. */ - private void assertArgumentPresent(ArgumentMultimap argMultimap, Prefix prefix, String... expectedValues) { + private void assertArgumentPresent(ArgumentMultimap argMultimap, Flag flag, String... expectedValues) { // Verify the last value is returned - assertEquals(expectedValues[expectedValues.length - 1], argMultimap.getValue(prefix).get()); + assertEquals(expectedValues[expectedValues.length - 1], argMultimap.getValue(flag).get()); // Verify the number of values returned is as expected - assertEquals(expectedValues.length, argMultimap.getAllValues(prefix).size()); + assertEquals(expectedValues.length, argMultimap.getAllValues(flag).size()); // Verify all values returned are as expected and in order for (int i = 0; i < expectedValues.length; i++) { - assertEquals(expectedValues[i], argMultimap.getAllValues(prefix).get(i)); + assertEquals(expectedValues[i], argMultimap.getAllValues(flag).get(i)); } } - private void assertArgumentAbsent(ArgumentMultimap argMultimap, Prefix prefix) { - assertFalse(argMultimap.getValue(prefix).isPresent()); + private void assertArgumentAbsent(ArgumentMultimap argMultimap, Flag flag) { + assertFalse(argMultimap.getValue(flag).isPresent()); } @Test - public void tokenize_noPrefixes_allTakenAsPreamble() { + public void tokenize_noFlags_allTakenAsPreamble() { String argsString = " some random string /t tag with leading and trailing spaces "; ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(argsString); @@ -106,13 +106,13 @@ public void tokenize_multipleArguments() { assertPreambleEmpty(argMultimap); assertArgumentAbsent(argMultimap, pSlash); - /* Also covers: testing for prefixes not specified as a prefix */ + /* Also covers: testing for flags not specified as a flag */ // Prefixes not previously given to the tokenizer should not return any values - argsString = unknownPrefix + "some value"; + argsString = unknownFlag + "some value"; argMultimap = ArgumentTokenizer.tokenize(argsString, pSlash, dashT, hatQ); - assertArgumentAbsent(argMultimap, unknownPrefix); - assertPreamblePresent(argMultimap, argsString); // Unknown prefix is taken as part of preamble + assertArgumentAbsent(argMultimap, unknownFlag); + assertPreamblePresent(argMultimap, argsString); // Unknown flag is taken as part of preamble } @Test @@ -138,13 +138,14 @@ public void tokenize_multipleArgumentsJoined() { @Test public void equalsMethod() { - Prefix aaa = new Prefix("aaa"); + Flag aaa = new Flag("aaa", "-", ""); assertEquals(aaa, aaa); - assertEquals(aaa, new Prefix("aaa")); + assertEquals(aaa, new Flag("aaa", "-", null)); - assertNotEquals(aaa, "aaa"); - assertNotEquals(aaa, new Prefix("aab")); + assertNotEquals(aaa, "-aaa"); + assertNotEquals(aaa, new Flag("aab", "-", null)); + assertNotEquals(aaa, new Flag("aaa", null, "/")); } } diff --git a/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java b/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java index a16f9c254b1..0c2d08c3eb6 100644 --- a/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java @@ -22,10 +22,10 @@ import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_FRIEND; import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_HUSBAND; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.FLAG_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.FLAG_EMAIL; +import static seedu.address.logic.parser.CliSyntax.FLAG_PHONE; +import static seedu.address.logic.parser.CliSyntax.FLAG_TAG; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_CONTACT; @@ -47,7 +47,7 @@ public class EditCommandParserTest { - private static final String TAG_EMPTY = " " + PREFIX_TAG; + private static final String TAG_EMPTY = " " + FLAG_TAG; private static final String MESSAGE_INVALID_FORMAT = String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE); @@ -77,7 +77,7 @@ public void parse_invalidPreamble_failure() { // invalid arguments being parsed as preamble assertParseFailure(parser, "1 some random string", MESSAGE_INVALID_FORMAT); - // invalid prefix being parsed as preamble + // invalid flag being parsed as preamble assertParseFailure(parser, "1 i/ string", MESSAGE_INVALID_FORMAT); } @@ -172,12 +172,12 @@ public void parse_multipleRepeatedFields_failure() { Index targetIndex = INDEX_FIRST_CONTACT; String userInput = targetIndex.getOneBased() + INVALID_PHONE_DESC + PHONE_DESC_BOB; - assertParseFailure(parser, userInput, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); + assertParseFailure(parser, userInput, Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE)); // invalid followed by valid userInput = targetIndex.getOneBased() + PHONE_DESC_BOB + INVALID_PHONE_DESC; - assertParseFailure(parser, userInput, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); + assertParseFailure(parser, userInput, Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE)); // mulltiple valid fields repeated userInput = targetIndex.getOneBased() + PHONE_DESC_AMY + ADDRESS_DESC_AMY + EMAIL_DESC_AMY @@ -185,14 +185,14 @@ public void parse_multipleRepeatedFields_failure() { + PHONE_DESC_BOB + ADDRESS_DESC_BOB + EMAIL_DESC_BOB + TAG_DESC_HUSBAND; assertParseFailure(parser, userInput, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS)); + Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE, FLAG_EMAIL, FLAG_ADDRESS)); // multiple invalid values userInput = targetIndex.getOneBased() + INVALID_PHONE_DESC + INVALID_ADDRESS_DESC + INVALID_EMAIL_DESC + INVALID_PHONE_DESC + INVALID_ADDRESS_DESC + INVALID_EMAIL_DESC; assertParseFailure(parser, userInput, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS)); + Messages.getErrorMessageForDuplicateFlags(FLAG_PHONE, FLAG_EMAIL, FLAG_ADDRESS)); } @Test diff --git a/src/test/java/seedu/address/testutil/ContactUtil.java b/src/test/java/seedu/address/testutil/ContactUtil.java index 069e03b189b..0c2c1f3e1da 100644 --- a/src/test/java/seedu/address/testutil/ContactUtil.java +++ b/src/test/java/seedu/address/testutil/ContactUtil.java @@ -1,10 +1,10 @@ package seedu.address.testutil; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.FLAG_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.FLAG_EMAIL; +import static seedu.address.logic.parser.CliSyntax.FLAG_NAME; +import static seedu.address.logic.parser.CliSyntax.FLAG_PHONE; +import static seedu.address.logic.parser.CliSyntax.FLAG_TAG; import java.util.Set; @@ -30,12 +30,12 @@ public static String getAddCommand(Contact contact) { */ public static String getContactDetails(Contact contact) { StringBuilder sb = new StringBuilder(); - sb.append(PREFIX_NAME + contact.getName().fullName + " "); - sb.append(PREFIX_PHONE + contact.getPhone().value + " "); - sb.append(PREFIX_EMAIL + contact.getEmail().value + " "); - sb.append(PREFIX_ADDRESS + contact.getAddress().value + " "); + sb.append(FLAG_NAME + contact.getName().fullName + " "); + sb.append(FLAG_PHONE + contact.getPhone().value + " "); + sb.append(FLAG_EMAIL + contact.getEmail().value + " "); + sb.append(FLAG_ADDRESS + contact.getAddress().value + " "); contact.getTags().stream().forEach( - s -> sb.append(PREFIX_TAG + s.tagName + " ") + s -> sb.append(FLAG_TAG + s.tagName + " ") ); return sb.toString(); } @@ -45,16 +45,16 @@ public static String getContactDetails(Contact contact) { */ public static String getEditContactDescriptorDetails(EditContactDescriptor descriptor) { StringBuilder sb = new StringBuilder(); - descriptor.getName().ifPresent(name -> sb.append(PREFIX_NAME).append(name.fullName).append(" ")); - descriptor.getPhone().ifPresent(phone -> sb.append(PREFIX_PHONE).append(phone.value).append(" ")); - descriptor.getEmail().ifPresent(email -> sb.append(PREFIX_EMAIL).append(email.value).append(" ")); - descriptor.getAddress().ifPresent(address -> sb.append(PREFIX_ADDRESS).append(address.value).append(" ")); + descriptor.getName().ifPresent(name -> sb.append(FLAG_NAME).append(name.fullName).append(" ")); + descriptor.getPhone().ifPresent(phone -> sb.append(FLAG_PHONE).append(phone.value).append(" ")); + descriptor.getEmail().ifPresent(email -> sb.append(FLAG_EMAIL).append(email.value).append(" ")); + descriptor.getAddress().ifPresent(address -> sb.append(FLAG_ADDRESS).append(address.value).append(" ")); if (descriptor.getTags().isPresent()) { Set