Skip to content

Commit 57be8aa

Browse files
committed
Merge pull request iluwatar#375 from DevFactory/release/The-members-of-an-interface-declaration-or-class-should-appear-in-a-pre-defined-order-fix-1
squid:S1213 - The members of an interface declaration or class should…
2 parents 1655f30 + 9c57457 commit 57be8aa

File tree

11 files changed

+103
-103
lines changed

11 files changed

+103
-103
lines changed

builder/src/main/java/com/iluwatar/builder/Hero.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ public class Hero {
3636
private final Armor armor;
3737
private final Weapon weapon;
3838

39+
private Hero(HeroBuilder builder) {
40+
this.profession = builder.profession;
41+
this.name = builder.name;
42+
this.hairColor = builder.hairColor;
43+
this.hairType = builder.hairType;
44+
this.weapon = builder.weapon;
45+
this.armor = builder.armor;
46+
}
47+
3948
public Profession getProfession() {
4049
return profession;
4150
}
@@ -88,15 +97,6 @@ public String toString() {
8897
return sb.toString();
8998
}
9099

91-
private Hero(HeroBuilder builder) {
92-
this.profession = builder.profession;
93-
this.name = builder.name;
94-
this.hairColor = builder.hairColor;
95-
this.hairType = builder.hairType;
96-
this.weapon = builder.weapon;
97-
this.armor = builder.armor;
98-
}
99-
100100
/**
101101
*
102102
* The builder class.

naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@
2424
@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
2525
public class HomePageService {
2626

27-
// region > homePage (action)
28-
29-
@Action(semantics = SemanticsOf.SAFE)
30-
@HomePage
31-
public HomePageViewModel homePage() {
32-
return container.injectServicesInto(new HomePageViewModel());
33-
}
34-
3527
// endregion
3628

3729
// region > injected services
@@ -40,4 +32,13 @@ public HomePageViewModel homePage() {
4032
DomainObjectContainer container;
4133

4234
// endregion
35+
36+
// region > homePage (action)
37+
38+
@Action(semantics = SemanticsOf.SAFE)
39+
@HomePage
40+
public HomePageViewModel homePage() {
41+
return container.injectServicesInto(new HomePageViewModel());
42+
}
43+
4344
}

naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
@ViewModel
2525
public class HomePageViewModel {
2626

27+
// endregion
28+
29+
// region > injected services
30+
31+
@javax.inject.Inject
32+
SimpleObjects simpleObjects;
33+
34+
// endregion
35+
2736
// region > title
2837
public String title() {
2938
return getObjects().size() + " objects";
@@ -37,12 +46,4 @@ public List<SimpleObject> getObjects() {
3746
return simpleObjects.listAll();
3847
}
3948

40-
// endregion
41-
42-
// region > injected services
43-
44-
@javax.inject.Inject
45-
SimpleObjects simpleObjects;
46-
47-
// endregion
4849
}

naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@
4848
@DomainObjectLayout(bookmarking = BookmarkPolicy.AS_ROOT, cssClassFa = "fa-flag")
4949
public class SimpleObject implements Comparable<SimpleObject> {
5050

51-
52-
// region > identificatiom
53-
public TranslatableString title() {
54-
return TranslatableString.tr("Object: {name}", "name", getName());
55-
}
56-
5751
// endregion
5852

5953
// region > name (property)
6054

6155
private String name;
56+
57+
// region > identificatiom
58+
public TranslatableString title() {
59+
return TranslatableString.tr("Object: {name}", "name", getName());
60+
}
6261

6362
@javax.jdo.annotations.Column(allowsNull = "false", length = 40)
6463
@Title(sequence = "1")

naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
@DomainService(repositoryFor = SimpleObject.class)
3434
@DomainServiceLayout(menuOrder = "10")
3535
public class SimpleObjects {
36+
// endregion
37+
38+
// region > injected services
39+
40+
@javax.inject.Inject
41+
DomainObjectContainer container;
42+
43+
// endregion
3644

3745
// region > title
3846
public TranslatableString title() {
@@ -81,12 +89,4 @@ public SimpleObject create(@ParameterLayout(named = "Name") final String name) {
8189
return obj;
8290
}
8391

84-
// endregion
85-
86-
// region > injected services
87-
88-
@javax.inject.Inject
89-
DomainObjectContainer container;
90-
91-
// endregion
9292
}

naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222

2323
public class SimpleObjectCreate extends FixtureScript {
2424

25+
// endregion
26+
27+
28+
// region > simpleObject (output)
29+
private SimpleObject simpleObject;
30+
31+
@javax.inject.Inject
32+
private SimpleObjects simpleObjects;
33+
2534
// region > name (input)
2635
private String name;
2736

@@ -36,13 +45,7 @@ public SimpleObjectCreate setName(final String name) {
3645
this.name = name;
3746
return this;
3847
}
39-
40-
// endregion
41-
42-
43-
// region > simpleObject (output)
44-
private SimpleObject simpleObject;
45-
48+
4649
/**
4750
* The created simple object (output).
4851
*/
@@ -62,8 +65,5 @@ protected void execute(final ExecutionContext ec) {
6265
// also make available to UI
6366
ec.addResult(this, simpleObject);
6467
}
65-
66-
@javax.inject.Inject
67-
private SimpleObjects simpleObjects;
68-
68+
6969
}

naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020

2121
public class SimpleObjectsTearDown extends FixtureScript {
2222

23+
@javax.inject.Inject
24+
private IsisJdoSupport isisJdoSupport;
25+
2326
@Override
2427
protected void execute(ExecutionContext executionContext) {
2528
isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
2629
}
27-
28-
29-
@javax.inject.Inject
30-
private IsisJdoSupport isisJdoSupport;
31-
30+
3231
}

naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,18 @@ public class RecreateSimpleObjects extends FixtureScript {
3232
public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz",
3333
"Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo"));
3434

35-
public RecreateSimpleObjects() {
36-
withDiscoverability(Discoverability.DISCOVERABLE);
37-
}
38-
3935
// region > number (optional input)
4036
private Integer number;
4137

38+
// endregion
39+
40+
// region > simpleObjects (output)
41+
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
42+
43+
public RecreateSimpleObjects() {
44+
withDiscoverability(Discoverability.DISCOVERABLE);
45+
}
46+
4247
/**
4348
* The number of objects to create, up to 10; optional, defaults to 3.
4449
*/
@@ -50,12 +55,7 @@ public RecreateSimpleObjects setNumber(final Integer number) {
5055
this.number = number;
5156
return this;
5257
}
53-
54-
// endregion
55-
56-
// region > simpleObjects (output)
57-
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
58-
58+
5959
/**
6060
* The simpleobjects created by this fixture (output).
6161
*/

service-layer/src/main/java/com/iluwatar/servicelayer/spell/Spell.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,30 @@ public class Spell extends BaseEntity {
4444

4545
private String name;
4646

47+
@Id
48+
@GeneratedValue
49+
@Column(name = "SPELL_ID")
50+
private Long id;
51+
52+
@ManyToOne
53+
@JoinColumn(name = "SPELLBOOK_ID_FK", referencedColumnName = "SPELLBOOK_ID")
54+
private Spellbook spellbook;
55+
4756
public Spell() {}
4857

4958
public Spell(String name) {
5059
this();
5160
this.name = name;
5261
}
53-
54-
@Id
55-
@GeneratedValue
56-
@Column(name = "SPELL_ID")
57-
private Long id;
58-
62+
5963
public Long getId() {
6064
return id;
6165
}
6266

6367
public void setId(Long id) {
6468
this.id = id;
6569
}
66-
67-
@ManyToOne
68-
@JoinColumn(name = "SPELLBOOK_ID_FK", referencedColumnName = "SPELLBOOK_ID")
69-
private Spellbook spellbook;
70-
70+
7171
public String getName() {
7272
return name;
7373
}

service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/Spellbook.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@
4848
@Table(name = "SPELLBOOK")
4949
public class Spellbook extends BaseEntity {
5050

51+
@Id
52+
@GeneratedValue
53+
@Column(name = "SPELLBOOK_ID")
54+
private Long id;
55+
56+
private String name;
57+
58+
@ManyToMany(mappedBy = "spellbooks", fetch = FetchType.EAGER)
59+
private Set<Wizard> wizards;
60+
61+
@OneToMany(mappedBy = "spellbook", orphanRemoval = true, cascade = CascadeType.ALL)
62+
private Set<Spell> spells;
63+
5164
public Spellbook() {
5265
spells = new HashSet<>();
5366
wizards = new HashSet<>();
@@ -57,28 +70,15 @@ public Spellbook(String name) {
5770
this();
5871
this.name = name;
5972
}
60-
61-
@Id
62-
@GeneratedValue
63-
@Column(name = "SPELLBOOK_ID")
64-
private Long id;
65-
73+
6674
public Long getId() {
6775
return id;
6876
}
6977

7078
public void setId(Long id) {
7179
this.id = id;
7280
}
73-
74-
private String name;
75-
76-
@ManyToMany(mappedBy = "spellbooks", fetch = FetchType.EAGER)
77-
private Set<Wizard> wizards;
78-
79-
@OneToMany(mappedBy = "spellbook", orphanRemoval = true, cascade = CascadeType.ALL)
80-
private Set<Spell> spells;
81-
81+
8282
public String getName() {
8383
return name;
8484
}

0 commit comments

Comments
 (0)