1 package org.fedoracommons.funapi;
2
3
4
5
6
7
8
9
10 public class UnapiFormat {
11 private String name;
12 private String type;
13 private String docs;
14
15 public UnapiFormat(String name, String type, String docs) {
16 this(new String[] {name, type, docs});
17 }
18
19 public UnapiFormat(String[] nameTypeDocs) {
20 if (nameTypeDocs == null || nameTypeDocs.length == 0) {
21 throw new IllegalArgumentException("nameTypeDocs cannot be empty");
22 } else if (nameTypeDocs.length == 2) {
23 setName(nameTypeDocs[0]);
24 setType(nameTypeDocs[1]);
25 setDocs(null);
26 } else if (nameTypeDocs.length == 3) {
27 setName(nameTypeDocs[0]);
28 setType(nameTypeDocs[1]);
29 setDocs(nameTypeDocs[2]);
30 } else {
31 throw new IllegalArgumentException("Expected [name, type, docs]");
32 }
33 }
34
35 public String getName() {
36 return name;
37 }
38
39 public void setName(String name) {
40 if (name == null || name.length() == 0) {
41 throw new IllegalArgumentException("name must be provided");
42 }
43 this.name = name;
44 }
45
46 public String getType() {
47 return type;
48 }
49
50 public void setType(String type) {
51 if (type == null || type.length() == 0) {
52 throw new IllegalArgumentException("type must be provided");
53 }
54 this.type = type;
55 }
56
57 public String getDocs() {
58 return docs;
59 }
60
61 public void setDocs(String docs) {
62 this.docs = docs;
63 }
64 }