-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttributeEntity.java
More file actions
166 lines (148 loc) · 4.37 KB
/
AttributeEntity.java
File metadata and controls
166 lines (148 loc) · 4.37 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package net.onelitefeather.vulpes.api.model;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import java.util.UUID;
/**
* Represents an Attribute in the system. This class is used as an entity for persistence
* with JPA and Micronaut Data. It contains details related to an attribute such as name,
* default value, maximum value, etc.
* <p>
* This class is mapped to the database table "vulpes_attributes" and contains fields that
* are automatically persisted by the JPA and Micronaut Data layers.
* </p>
*/
@Entity(name = "attributes")
public class AttributeEntity implements VulpesModel {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@VulpesGenerator
private UUID id;
private String uiName;
private String variableName;
private double defaultValue;
private double maximumValue;
/**
* Default constructor for JPA and Micronaut Data.
* <p>
* This constructor is required for the JPA provider to instantiate the entity.
* </p>
*/
public AttributeEntity() {
// No-argument constructor for JPA
}
/**
* Constructs a new {@link AttributeEntity} with the specified values.
*
* @param id the unique identifier of the attribute
* @param uiName the model name associated with the attribute
* @param variableName the name of the attribute
* @param defaultValue the default value of the attribute
* @param maximumValue the maximum value of the attribute
*/
public AttributeEntity(UUID id, String uiName, String variableName, double defaultValue, double maximumValue) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
this.defaultValue = defaultValue;
this.maximumValue = maximumValue;
}
// Getters and setters for each field
/**
* Returns the unique identifier of the attribute
*
* @return the unique identifier of the attribute
*/
public UUID getId() {
return id;
}
/**
* Sets the unique identifier of the attribute
*
* @param id the unique identifier to set
*/
public void setId(UUID id) {
this.id = id;
}
/**
* Returns the model name associated with the attribute
*
* @return the model name of the attribute
*/
public String getUiName() {
return uiName;
}
/**
* Sets the model name associated with the attribute
*
* @param modelName the model name to set
*/
public void setUiName(String modelName) {
this.uiName = modelName;
}
/**
* Returns the name of the attribute
*
* @return the name of the attribute
*/
public String getVariableName() {
return variableName;
}
/**
* Sets the name of the attribute
*
* @param name the name to set
*/
public void setVariableName(String name) {
this.variableName = name;
}
/**
* Returns the default value of the attribute
*
* @return the default value of the attribute
*/
public double getDefaultValue() {
return defaultValue;
}
/**
* Sets the default value of the attribute
*
* @param defaultValue the default value to set
*/
public void setDefaultValue(double defaultValue) {
this.defaultValue = defaultValue;
}
/**
* Returns the maximum value of the attribute
*
* @return the maximum value of the attribute
*/
public double getMaximumValue() {
return maximumValue;
}
/**
* Sets the maximum value of the attribute
*
* @param maximumValue the maximum value to set
*/
public void setMaximumValue(double maximumValue) {
this.maximumValue = maximumValue;
}
/**
* Provides a string representation of the AttributeModel
*
* @return a string representation
*/
@Override
public String toString() {
return "AttributeModel{" +
"id='" + id + '\'' +
", modelName='" + uiName + '\'' +
", name='" + variableName + '\'' +
", defaultValue=" + defaultValue +
", maximumValue=" + maximumValue +
'}';
}
}