This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
DefaultFields.java
135 lines (123 loc) · 3.32 KB
/
DefaultFields.java
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package org.eclipse.ice.dev.annotations.processors;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* Aggregation of fields generated and included in <code>@DataElement</code>
* by default.
*/
public class DefaultFields {
/**
* The private UUID of this element.
*
* This field is left out of the <code>DataElement.matches</code> checks.
*/
private static Field privateId = Field.builder()
.name("privateId")
.type(UUID.class)
.docString("The private UUID of this element. This field is left out of matches().")
.defaultValue(Field.raw("UUID.randomUUID()"))
.match(false)
.getter(false)
.setter(false)
.alias(
FieldAlias.builder()
.alias("UUID")
.getter(true)
.build()
)
.defaultField(true)
.build();
/**
* A unique identifier for this element.
*/
private static Field id = Field.builder()
.name("id")
.type(long.class)
.docString("A unique identifier for this element.")
.defaultValue(0L)
.defaultField(true)
.build();
/**
* A simple name for the data.
*/
private static Field name = Field.builder()
.name("name")
.type(String.class)
.docString("A simple name for the data.")
.defaultValue("name")
.defaultField(true)
.build();
/**
* A simple description of the data.
*/
private static Field description = Field.builder()
.name("description")
.type(String.class)
.docString("A simple description of the data")
.defaultValue("description")
.defaultField(true)
.build();
/**
* A comment that annotates the data in a meaningful way.
*/
private static Field comment = Field.builder()
.name("comment")
.type(String.class)
.docString("A comment that annotates the data in a meaningful way.")
.defaultValue("no comment")
.defaultField(true)
.build();
/**
* The context (a tag) in which the data should be considered.
*/
private static Field context = Field.builder()
.name("context")
.type(String.class)
.docString("The context (a tag) in which the data should be considered.")
.defaultValue("default")
.defaultField(true)
.build();
/**
* This value is true if the element should be regarded as a client as required.
*/
private static Field required = Field.builder()
.name("required")
.type(boolean.class)
.docString("This value is true if the element should be regarded by the client as required.")
.defaultValue(false)
.defaultField(true)
.build();
/**
* This value is true if the element should be regarded as a secret by a client,
* such as for passwords.
*/
private static Field secret = Field.builder()
.name("secret")
.type(boolean.class)
.docString("This value is true if the element should be regarded as a secret by the client, such as for passwords.")
.defaultValue(false)
.defaultField(true)
.build();
/**
* The validator used to check the correctness of the data.
*/
private static Field validator = Field.builder()
.name("validator")
.type(Field.raw("JavascriptValidator<$class>"))
.docString("The validator used to check the correctness of the data.")
.nullable(true)
.defaultField(true)
.search(false)
.build();
/**
* Get the statically defined default fields.
* @return list of Fields
*/
public static List<Field> get() {
return Arrays.asList(
privateId, id, name, description, comment,
context, required, secret, validator
);
}
}