Skip to content

Commit 525591b

Browse files
committed
chore(entities): add documentation and improve constructor definition
1 parent 6110ff5 commit 525591b

4 files changed

Lines changed: 205 additions & 28 deletions

File tree

src/main/java/net/onelitefeather/vulpes/api/model/font/FontStringEntity.java

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,98 @@ public final class FontStringEntity implements Comparable<FontStringEntity> {
2424
private FontEntity font;
2525
private int orderIndex;
2626

27+
/**
28+
* Default constructor for JPA.
29+
*/
2730
public FontStringEntity() {
31+
// No-argument constructor for JPA
2832
}
2933

34+
/**
35+
* Constructs a new {@link FontStringEntity} with the specified values.
36+
*
37+
* @param id the unique identifier of the font string
38+
* @param content the content of the font string
39+
* @param orderIndex the order index of the font string
40+
*/
3041
public FontStringEntity(
3142
UUID id,
3243
String content,
33-
FontEntity font,
3444
int orderIndex
3545
) {
3646
this.id = id;
3747
this.line = content;
38-
this.font = font;
3948
this.orderIndex = orderIndex;
4049
}
4150

51+
/**
52+
* Sets the unique identifier of the font string.
53+
*
54+
* @param id the unique identifier to set
55+
*/
4256
public void setId(UUID id) {
4357
this.id = id;
4458
}
4559

60+
/**
61+
* Gets the unique identifier of the font string.
62+
*
63+
* @return the unique identifier
64+
*/
4665
public UUID getId() {
4766
return id;
4867
}
4968

69+
/**
70+
* Sets the content of the font string.
71+
*
72+
* @param line the content to set
73+
*/
5074
public void setLine(String line) {
5175
this.line = line;
5276
}
5377

78+
/**
79+
* Gets the content of the font string.
80+
*
81+
* @return the content
82+
*/
5483
public String getLine() {
5584
return line;
5685
}
5786

87+
/**
88+
* Sets the font associated with this font string.
89+
*
90+
* @param font the font to set
91+
*/
5892
public void setFont(FontEntity font) {
5993
this.font = font;
6094
}
6195

96+
/**
97+
* Gets the font associated with this font string.
98+
*
99+
* @return the font
100+
*/
62101
public FontEntity getFont() {
63102
return font;
64103
}
65104

105+
/**
106+
* Sets the order index of the font string.
107+
*
108+
* @param orderIndex the order index to set
109+
*/
66110
public void setOrderIndex(int orderIndex) {
67111
this.orderIndex = orderIndex;
68112
}
69113

114+
/**
115+
* Gets the order index of the font string.
116+
*
117+
* @return the order index
118+
*/
70119
public int getOrderIndex() {
71120
return orderIndex;
72121
}

src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,50 +24,98 @@ public final class ItemEnchantmentEntity {
2424
@JoinColumn(name = "item_id", nullable = false)
2525
private ItemEntity item;
2626

27+
/**
28+
* Default constructor for JPA and Micronaut Data.
29+
*/
2730
public ItemEnchantmentEntity() {
28-
31+
// No-argument constructor for JPA
2932
}
3033

34+
/**
35+
* Constructs a new {@link ItemEnchantmentEntity} with the specified values.
36+
*
37+
* @param id the unique identifier of the item enchantment
38+
* @param name the name of the enchantment
39+
* @param level the level of the enchantment
40+
*/
3141
public ItemEnchantmentEntity(
3242
UUID id,
3343
String name,
34-
short level,
35-
ItemEntity item
44+
short level
3645
) {
3746
this.id = id;
3847
this.name = name;
3948
this.level = level;
40-
this.item = item;
4149
}
4250

51+
/**
52+
* Returns the unique identifier of the item enchantment.
53+
*
54+
* @return the id
55+
*/
4356
public UUID getId() {
4457
return id;
4558
}
4659

60+
/**
61+
* Sets the unique identifier of the item enchantment.
62+
*
63+
* @param id the id to set
64+
*/
4765
public void setId(UUID id) {
4866
this.id = id;
4967
}
5068

69+
/**
70+
* Returns the name of the enchantment.
71+
*
72+
* @return the name
73+
*/
5174
public String getName() {
5275
return name;
5376
}
5477

78+
/**
79+
* Sets the name of the enchantment.
80+
*
81+
* @param name the name to set
82+
*/
5583
public void setName(String name) {
5684
this.name = name;
5785
}
5886

87+
/**
88+
* Returns the level of the enchantment.
89+
*
90+
* @return the level
91+
*/
5992
public short getLevel() {
6093
return level;
6194
}
6295

96+
/**
97+
* Sets the level of the enchantment.
98+
*
99+
* @param level the level to set
100+
*/
63101
public void setLevel(short level) {
64102
this.level = level;
65103
}
66104

105+
/**
106+
* Returns the {@link ItemEntity} which is linked with this enchantment.
107+
*
108+
* @return the item associated with this enchantment
109+
*/
67110
public ItemEntity getItem() {
68111
return item;
69112
}
70113

114+
/**
115+
* Sets the item associated with this enchantment.
116+
*
117+
* @param item the item to associate with this enchantment
118+
*/
71119
public void setItem(ItemEntity item) {
72120
this.item = item;
73121
}

src/main/java/net/onelitefeather/vulpes/api/model/item/ItemFlagEntity.java

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,92 @@
1515
/**
1616
* The {@link ItemFlagEntity} represents a flag or attribute that can be associated with an item in the system.
1717
*
18+
* @author theEvilReaper
19+
* @version 1.1.0
20+
* @since 1.6.0
1821
*/
1922
@Entity(name = "item_flags")
2023
public final class ItemFlagEntity {
2124
@Id
2225
@GeneratedValue(strategy = GenerationType.UUID)
2326
@VulpesGenerator
2427
private UUID id;
25-
private String text;
28+
private String flag;
2629
@ManyToOne
2730
@JoinColumn(name = "item_id")
2831
private ItemEntity item;
2932

3033
/**
34+
* Default constructor for JPA and Micronaut Data.
35+
*/
36+
public ItemFlagEntity() {
37+
// No-argument constructor for JPA
38+
}
39+
40+
/**
41+
* Constructs a new {@link ItemFlagEntity} with the specified parameters.
42+
*
3143
* @param id the unique identifier of the item flag
32-
* @param text the descriptive text of the item flag
44+
* @param flag the descriptive text of the item flag
3345
*/
3446
public ItemFlagEntity(
3547
UUID id,
36-
String text,
37-
ItemEntity item
48+
String flag
3849
) {
3950
this.id = id;
40-
this.text = text;
41-
this.item = item;
42-
}
43-
44-
public ItemFlagEntity() {
45-
51+
this.flag = flag;
4652
}
4753

54+
/**
55+
* Sets the unique identifier of the item flag.
56+
*
57+
* @param id the unique identifier to set
58+
*/
4859
public void setId(UUID id) {
4960
this.id = id;
5061
}
5162

63+
/**
64+
* Gets the unique identifier of the item flag.
65+
*
66+
* @return the unique identifier
67+
*/
5268
public UUID getId() {
5369
return id;
5470
}
5571

56-
public void setText(String text) {
57-
this.text = text;
72+
/**
73+
* Sets the flag associated with the item.
74+
*
75+
* @param flag the item flag
76+
*/
77+
public void setFlag(String flag) {
78+
this.flag = flag;
5879
}
5980

60-
public String getText() {
61-
return text;
81+
/**
82+
* Gets the flag associated with the item.
83+
*
84+
* @return the item flag
85+
*/
86+
public String getFlag() {
87+
return flag;
6288
}
6389

90+
/**
91+
* Sets the item associated with this flag.
92+
*
93+
* @param item the item to associate
94+
*/
6495
public void setItem(ItemEntity item) {
6596
this.item = item;
6697
}
6798

99+
/**
100+
* Gets the item associated with this flag.
101+
*
102+
* @return the associated item
103+
*/
68104
public ItemEntity getItem() {
69105
return item;
70106
}
@@ -75,22 +111,20 @@ public boolean equals(Object obj) {
75111
if (obj == null || obj.getClass() != this.getClass()) return false;
76112
var that = (ItemFlagEntity) obj;
77113
return Objects.equals(this.id, that.id) &&
78-
Objects.equals(this.text, that.text) &&
114+
Objects.equals(this.flag, that.flag) &&
79115
Objects.equals(this.item, that.item);
80116
}
81117

82118
@Override
83119
public int hashCode() {
84-
return Objects.hash(id, text, item);
120+
return Objects.hash(id, flag, item);
85121
}
86122

87123
@Override
88124
public String toString() {
89125
return "ItemFlagEntity[" +
90126
"id=" + id + ", " +
91-
"text=" + text + ", " +
127+
"text=" + flag + ", " +
92128
"item=" + item + ']';
93129
}
94-
95-
96130
}

0 commit comments

Comments
 (0)