1 package yarfraw.mapping.forward.impl;
2
3 import java.util.List;
4
5 import org.apache.commons.collections.CollectionUtils;
6
7 import yarfraw.core.datamodel.Link;
8 import yarfraw.core.datamodel.Person;
9
10 class Utils{
11 private Utils(){}
12
13 /***
14 * Gets the <code>emailOrText</code> field of the first person in the input list.
15 * @param persons
16 * @return
17 */
18 public static String getEmailOrText(List<Person> persons){
19 String ret = null;
20 if(CollectionUtils.isNotEmpty(persons)){
21 Person p = persons.get(0);
22 ret = p == null ? null : p.getEmailOrText();
23 }
24 return ret;
25 }
26
27 /***
28 * Gets the <code>href</code> field of the first link in the input list.
29 * @param links
30 * @return
31 */
32 public static String getHrefLink(List<Link> links){
33 String ret = null;
34 if(CollectionUtils.isNotEmpty(links)){
35 Link l = links.get(0);
36 ret = l == null ? null : l.getHref();
37 }
38 return ret;
39 }
40 }