forked from m0ver/tinystruct-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.java
More file actions
executable file
·121 lines (99 loc) · 3.1 KB
/
book.java
File metadata and controls
executable file
·121 lines (99 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package custom.objects;
import java.util.Date;
import org.tinystruct.data.component.Row;
import org.tinystruct.data.component.AbstractData;
public class book extends AbstractData {
private String name;
private String cover;
private String author;
private String translator;
private String publisher;
private Date publishDate;
private String language;
public String getId()
{
return String.valueOf(this.Id);
}
public void setName(String name)
{
this.name=this.setFieldAsString("name",name);
}
public String getName()
{
return this.name;
}
public void setCover(String cover)
{
this.cover=this.setFieldAsString("cover",cover);
}
public String getCover()
{
return this.cover;
}
public void setAuthor(String author)
{
this.author=this.setFieldAsString("author",author);
}
public String getAuthor()
{
return this.author;
}
public void setTranslator(String translator)
{
this.translator=this.setFieldAsString("translator",translator);
}
public String getTranslator()
{
return this.translator;
}
public void setPublisher(String publisher)
{
this.publisher=this.setFieldAsString("publisher",publisher);
}
public String getPublisher()
{
return this.publisher;
}
public void setPublishDate(Date publishDate)
{
this.publishDate=this.setFieldAsDate("publishDate",publishDate);
}
public Date getPublishDate()
{
return this.publishDate;
}
public void setLanguage(String language)
{
this.language=this.setFieldAsString("language",language);
}
public String getLanguage()
{
return this.language;
}
@Override
public void setData(Row row) {
if(row.getFieldInfo("id")!=null) this.setId(row.getFieldInfo("id").stringValue());
if(row.getFieldInfo("name")!=null) this.setName(row.getFieldInfo("name").stringValue());
if(row.getFieldInfo("cover")!=null) this.setCover(row.getFieldInfo("cover").stringValue());
if(row.getFieldInfo("author")!=null) this.setAuthor(row.getFieldInfo("author").stringValue());
if(row.getFieldInfo("translator")!=null) this.setTranslator(row.getFieldInfo("translator").stringValue());
if(row.getFieldInfo("publisher")!=null) this.setPublisher(row.getFieldInfo("publisher").stringValue());
if(row.getFieldInfo("publish_date")!=null) this.setPublishDate(row.getFieldInfo("publish_date").dateValue());
if(row.getFieldInfo("language")!=null) this.setLanguage(row.getFieldInfo("language").stringValue());
}
@Override
public String toString() {
StringBuffer buffer=new StringBuffer();
buffer.append("{");
buffer.append("\"Id\":\""+this.getId()+"\"");
buffer.append(",\"name\":\""+this.getName()+"\"");
buffer.append(",\"cover\":\""+this.getCover()+"\"");
buffer.append(",\"author\":\""+this.getAuthor()+"\"");
buffer.append(",\"translator\":\""+this.getTranslator()+"\"");
buffer.append(",\"publisher\":\""+this.getPublisher()+"\"");
buffer.append(",\"publishDate\":\""+this.getPublishDate()+"\"");
buffer.append(",\"language\":\""+this.getLanguage()+"\"");
buffer.append("}");
return buffer.toString();
}
}