Back to project page BackbeamAndroid.
The source code is released under:
Copyright (c) 2012 Level Apps S.L. <http://backbeam.io> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software...
If you think the Android project BackbeamAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.backbeam; //from ww w.j a v a 2 s. c o m import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class CollectionConstraint { private List<String> ids = new ArrayList<String>(); public CollectionConstraint addObject(BackbeamObject object) { if (object.getId() != null) { ids.add(object.getId()); } return this; } public CollectionConstraint addObjects(List<BackbeamObject> objects) { for (BackbeamObject obj : objects) { addObject(obj); } return this; } public CollectionConstraint addIdentifier(String identifier) { if (identifier != null) { ids.add(identifier); } return this; } public CollectionConstraint addIdentifiers(List<String> identifiers) { for (String identifier : identifiers) { if (identifier != null) { ids.add(identifier); } } return this; } private void addIdentifier(String identifier, String prefix) { ids.add(prefix+identifier); } private void addIdentifiers(List<String> identifiers, String prefix) { for (String identifier : identifiers) { ids.add(prefix+identifier); } } public void addTwitterIdentifier(String identifier) { addIdentifier(identifier, "tw:"); } public void addTwitterIdentifiers(List<String> identifiers) { addIdentifiers(identifiers, "tw:"); } public void addFacebookIdentifier(String identifier) { addIdentifier(identifier, "fb:"); } public void addFacebookIdentifiers(List<String> identifiers) { addIdentifiers(identifiers, "fb:"); } public void addEmailAddress(String identifier) { addIdentifier(identifier, "email:"); } public void addEmailAddresses(List<String> identifiers) { addIdentifiers(identifiers, "email:"); } public void addGooglePlus(String identifier) { addIdentifier(identifier, "gp:"); } public void addGooglePlus(List<String> identifiers) { addIdentifiers(identifiers, "gp:"); } public String toString() { StringBuilder sb = new StringBuilder(); Iterator<String> iter = ids.iterator(); if (iter.hasNext()) sb.append(iter.next()); while (iter.hasNext()) { sb.append("\n"); sb.append(iter.next()); } return sb.toString(); } }