BrightSide Workbench Full Report + Source Code
PropertyTag.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.vcard.properties;
19 
24 public enum PropertyTag {
25 
26  VCP_ID("X-ID", 1),
27  VCP_GID("X-GID", 1),
28  VCP_FN("FN", 1),
29  VCP_N("N", 5), // familyName, givenName, additionalNames[], prefixes, suffixes
30  VCP_ADR("ADR", 7), // poBox, extended, street, locality, region, postcode, country
31  VCP_EMAIL("EMAIL", 1),
32  VCP_TEL("TEL", 1),
33  VCP_NOTE("NOTE", 1),
34  VCP_SOURCE("SOURCE", 1),
35  VCP_TITLE("TITLE", 1);
36 
37  public static PropertyTag getInstance(String l) {
38  for(PropertyTag pt : PropertyTag.values()) {
39  if(l.startsWith(pt.tag + ";") || l.startsWith(pt.tag + ":")) {
40  return pt;
41  }
42  }
43  return null;
44  }
45 
46  private String tag;
47  private int valueCount;
48 
49  private PropertyTag(String tag, int valueCount) {
50  this.tag = tag;
51  this.valueCount = valueCount;
52  }
53 
54  public String getTag() {
55  return tag;
56  }
57 
58  public int getValueCount() {
59  return valueCount;
60  }
61 
62 }
static PropertyTag getInstance(String l)