blob: 87c82395b9a6bd02b73c3bb80bb33c166e2596fd (
plain)
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
|
package com.twine.tango.dal.entities;
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.ForeignKey;
import com.raizlabs.android.dbflow.annotation.ForeignKeyReference;
import com.raizlabs.android.dbflow.annotation.Table;
import org.joda.time.DateTime;
import com.twine.tango.dal.Entity;
import com.twine.tango.dal.TangoDB;
import android.databinding.Bindable;
import com.twine.tango.dal.BR;
@@Table(name = "@(Model.TableName)", database = TangoDB.class)
public class @(Model.Name) extends Entity
{
@foreach (var prop in Model.Fields)
{
if (!prop.Construct)
{
<div>
@@Column(name = "@(prop.FieldName)")
private @(prop.Type) @(prop.Description);
</div>
}
else
{
<div>
@@ForeignKey(references = { @@ForeignKeyReference(columnName = "@(prop.FieldName)_GUID", foreignKeyColumnName = "GUID")})
private @(prop.Type) @(prop.Description);
</div>
}
}
@foreach (var prop in Model.Fields)
{
<div>
/**
* Gets the @(prop.Name).
*
* return the @(prop.Name)
*/
@@Bindable
public @(prop.Type) @(prop.Type == "boolean" ? "is" + prop.Name : "get" + prop.Name)()
{
return @(prop.Description);
}
/**
* Sets the @(prop.Name).
*
* @@param @(prop.Description) the @(prop.Name)
*/
public void set@(prop.Name)(@(prop.Type) @(prop.Description))
{
this.@(prop.Description) = @(prop.Description);
notifyPropertyChanged(BR.@(prop.Description));
}
</div>
}
}
|