@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Email other = (Email) obj; return eq(getAddress(), other.getAddress()) && eq(getDisplayName(), other.getDisplayName()) && eq(getLabel(), other.getLabel()) && eq(getPrimary(), other.getPrimary()) && eq(getRel(), other.getRel()); }
@Override public int hashCode() { int result = getClass().hashCode(); if (getAddress() != null) { result = 37 * result + getAddress().hashCode(); } if (getDisplayName() != null) { result = 37 * result + getDisplayName().hashCode(); } if (getLabel() != null) { result = 37 * result + getLabel().hashCode(); } if (getPrimary() != null) { result = 37 * result + getPrimary().hashCode(); } if (getRel() != null) { result = 37 * result + getRel().hashCode(); } return result; }
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full"); ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class); for (ContactEntry entry : resultFeed.getEntries()) { for (Email email : entry.getEmailAddresses()) { if (email.getPrimary()) { System.out.print(" " + email.getAddress()); System.out.print("\n"); } } }
/** * Returns whether it has the email address. * * @return whether it has the email address */ public boolean hasAddress() { return getAddress() != null; }
/** * Returns whether it has the email type. * * @return whether it has the email type */ public boolean hasRel() { return getRel() != null; }
/** * Returns whether it has the label. * * @return whether it has the label */ public boolean hasLabel() { return getLabel() != null; }
/** * Returns whether it has the whether this is the primary email address. * * @return whether it has the whether this is the primary email address */ public boolean hasPrimary() { return getPrimary() != null; }
/** * Returns whether it has the displayName. * * @return whether it has the displayName */ public boolean hasDisplayName() { return getDisplayName() != null; }
@Override public int hashCode() { int result = getClass().hashCode(); if (getAddress() != null) { result = 37 * result + getAddress().hashCode(); } if (getDisplayName() != null) { result = 37 * result + getDisplayName().hashCode(); } if (getLabel() != null) { result = 37 * result + getLabel().hashCode(); } if (getPrimary() != null) { result = 37 * result + getPrimary().hashCode(); } if (getRel() != null) { result = 37 * result + getRel().hashCode(); } return result; } }
ContactsService myService = null; myService = new ContactsService(accessToken);//add here your access token myService.setAuthSubToken(accessToken);//add here your access token URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full?max-results=5000"); ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class); for (int i = 0; i < resultFeed.getEntries().size(); i++) { ContactEntry entry = resultFeed.getEntries().get(i); if (entry.hasName()) { Name name = entry.getName(); if (name.hasFullName()) { String fullNameToDisplay = name.getFullName().getValue(); if (name.getFullName().hasYomi()) { fullNameToDisplay += "(" + name.getFullName().getYomi() + ")"; } System.out.println(fullNameToDisplay); } for (Email email : entry.getEmailAddresses()) { System.out.println(email.getAddress()); } Link photoLink = entry.getContactPhotoLink(); String photoLinkHref = photoLink.getHref(); System.out.println("Photo Link:" + photoLinkHref+"\n"); } } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Email other = (Email) obj; return eq(getAddress(), other.getAddress()) && eq(getDisplayName(), other.getDisplayName()) && eq(getLabel(), other.getLabel()) && eq(getPrimary(), other.getPrimary()) && eq(getRel(), other.getRel()); }
@Override public int hashCode() { int result = getClass().hashCode(); if (getAddress() != null) { result = 37 * result + getAddress().hashCode(); } if (getDisplayName() != null) { result = 37 * result + getDisplayName().hashCode(); } if (getLabel() != null) { result = 37 * result + getLabel().hashCode(); } if (getPrimary() != null) { result = 37 * result + getPrimary().hashCode(); } if (getRel() != null) { result = 37 * result + getRel().hashCode(); } return result; } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Email other = (Email) obj; return eq(getAddress(), other.getAddress()) && eq(getDisplayName(), other.getDisplayName()) && eq(getLabel(), other.getLabel()) && eq(getPrimary(), other.getPrimary()) && eq(getRel(), other.getRel()); }
System.out.print(" " + email.getAddress()); if (email.getRel() != null) { System.out.print(" rel:" + email.getRel()); if (email.getLabel() != null) { System.out.print(" label:" + email.getLabel()); if (email.getPrimary()) { System.out.print(" (primary) ");