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
117 lines (105 loc) · 2.97 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
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)
.comment("The private UUID of this element. This field is left out of matches().")
.defaultValue(Field.raw("UUID.randomUUID()"))
.match(false)
.build();
/**
* A unique identifier for this element.
*/
private static Field id = Field.builder()
.name("id")
.type(long.class)
.comment("A unique identifier for this element.")
.defaultValue(0L)
.build();
/**
* A simple name for the data.
*/
private static Field name = Field.builder()
.name("name")
.type(String.class)
.comment("A simple name for the data.")
.defaultValue("name")
.build();
/**
* A simple description of the data.
*/
private static Field description = Field.builder()
.name("description")
.type(String.class)
.comment("A simple description of the data")
.defaultValue("description")
.build();
/**
* A comment that annotates the data in a meaningful way.
*/
private static Field comment = Field.builder()
.name("comment")
.type(String.class)
.comment("A comment that annotates the data in a meaningful way.")
.defaultValue("no comment")
.build();
/**
* The context (a tag) in which the data should be considered.
*/
private static Field context = Field.builder()
.name("context")
.type(String.class)
.comment("The context (a tag) in which the data should be considered.")
.defaultValue("default")
.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)
.comment("This value is true if the element should be regarded by the client as required.")
.defaultValue(false)
.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)
.comment("This value is true if the element should be regarded as a secret by the client, such as for passwords.")
.defaultValue(false)
.build();
/**
* The validator used to check the correctness of the data.
*/
private static Field validator = Field.builder()
.name("validator")
.type(Field.raw("JavascriptValidator<$class>"))
.comment("The validator used to check the correctness of the data.")
.nullable(true)
.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
);
}
}