squid:S1213 - The members of an interface declaration or class should appear in a pre-defined order

This commit is contained in:
Mohammed Ezzat
2016-02-06 01:10:56 +02:00
parent 33224dd7d7
commit 9c5745763d
11 changed files with 106 additions and 106 deletions

View File

@ -36,6 +36,15 @@ public class Hero {
private final Armor armor; private final Armor armor;
private final Weapon weapon; private final Weapon weapon;
private Hero(HeroBuilder builder) {
this.profession = builder.profession;
this.name = builder.name;
this.hairColor = builder.hairColor;
this.hairType = builder.hairType;
this.weapon = builder.weapon;
this.armor = builder.armor;
}
public Profession getProfession() { public Profession getProfession() {
return profession; return profession;
} }
@ -88,15 +97,6 @@ public class Hero {
return sb.toString(); return sb.toString();
} }
private Hero(HeroBuilder builder) {
this.profession = builder.profession;
this.name = builder.name;
this.hairColor = builder.hairColor;
this.hairType = builder.hairType;
this.weapon = builder.weapon;
this.armor = builder.armor;
}
/** /**
* *
* The builder class. * The builder class.

View File

@ -24,14 +24,6 @@ import org.apache.isis.applib.annotation.SemanticsOf;
@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) @DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
public class HomePageService { public class HomePageService {
// region > homePage (action)
@Action(semantics = SemanticsOf.SAFE)
@HomePage
public HomePageViewModel homePage() {
return container.injectServicesInto(new HomePageViewModel());
}
// endregion // endregion
// region > injected services // region > injected services
@ -40,4 +32,13 @@ public class HomePageService {
DomainObjectContainer container; DomainObjectContainer container;
// endregion // endregion
// region > homePage (action)
@Action(semantics = SemanticsOf.SAFE)
@HomePage
public HomePageViewModel homePage() {
return container.injectServicesInto(new HomePageViewModel());
}
} }

View File

@ -24,6 +24,15 @@ import domainapp.dom.modules.simple.SimpleObjects;
@ViewModel @ViewModel
public class HomePageViewModel { public class HomePageViewModel {
// endregion
// region > injected services
@javax.inject.Inject
SimpleObjects simpleObjects;
// endregion
// region > title // region > title
public String title() { public String title() {
return getObjects().size() + " objects"; return getObjects().size() + " objects";
@ -37,12 +46,4 @@ public class HomePageViewModel {
return simpleObjects.listAll(); return simpleObjects.listAll();
} }
// endregion
// region > injected services
@javax.inject.Inject
SimpleObjects simpleObjects;
// endregion
} }

View File

@ -48,17 +48,16 @@ import org.apache.isis.applib.util.ObjectContracts;
@DomainObjectLayout(bookmarking = BookmarkPolicy.AS_ROOT, cssClassFa = "fa-flag") @DomainObjectLayout(bookmarking = BookmarkPolicy.AS_ROOT, cssClassFa = "fa-flag")
public class SimpleObject implements Comparable<SimpleObject> { public class SimpleObject implements Comparable<SimpleObject> {
// region > identificatiom
public TranslatableString title() {
return TranslatableString.tr("Object: {name}", "name", getName());
}
// endregion // endregion
// region > name (property) // region > name (property)
private String name; private String name;
// region > identificatiom
public TranslatableString title() {
return TranslatableString.tr("Object: {name}", "name", getName());
}
@javax.jdo.annotations.Column(allowsNull = "false", length = 40) @javax.jdo.annotations.Column(allowsNull = "false", length = 40)
@Title(sequence = "1") @Title(sequence = "1")

View File

@ -33,6 +33,14 @@ import org.apache.isis.applib.services.i18n.TranslatableString;
@DomainService(repositoryFor = SimpleObject.class) @DomainService(repositoryFor = SimpleObject.class)
@DomainServiceLayout(menuOrder = "10") @DomainServiceLayout(menuOrder = "10")
public class SimpleObjects { public class SimpleObjects {
// endregion
// region > injected services
@javax.inject.Inject
DomainObjectContainer container;
// endregion
// region > title // region > title
public TranslatableString title() { public TranslatableString title() {
@ -81,12 +89,4 @@ public class SimpleObjects {
return obj; return obj;
} }
// endregion
// region > injected services
@javax.inject.Inject
DomainObjectContainer container;
// endregion
} }

View File

@ -22,6 +22,15 @@ import domainapp.dom.modules.simple.SimpleObjects;
public class SimpleObjectCreate extends FixtureScript { public class SimpleObjectCreate extends FixtureScript {
// endregion
// region > simpleObject (output)
private SimpleObject simpleObject;
@javax.inject.Inject
private SimpleObjects simpleObjects;
// region > name (input) // region > name (input)
private String name; private String name;
@ -36,13 +45,7 @@ public class SimpleObjectCreate extends FixtureScript {
this.name = name; this.name = name;
return this; return this;
} }
// endregion
// region > simpleObject (output)
private SimpleObject simpleObject;
/** /**
* The created simple object (output). * The created simple object (output).
*/ */
@ -62,8 +65,5 @@ public class SimpleObjectCreate extends FixtureScript {
// also make available to UI // also make available to UI
ec.addResult(this, simpleObject); ec.addResult(this, simpleObject);
} }
@javax.inject.Inject
private SimpleObjects simpleObjects;
} }

View File

@ -20,13 +20,12 @@ import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
public class SimpleObjectsTearDown extends FixtureScript { public class SimpleObjectsTearDown extends FixtureScript {
@javax.inject.Inject
private IsisJdoSupport isisJdoSupport;
@Override @Override
protected void execute(ExecutionContext executionContext) { protected void execute(ExecutionContext executionContext) {
isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\""); isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
} }
@javax.inject.Inject
private IsisJdoSupport isisJdoSupport;
} }

View File

@ -32,13 +32,18 @@ public class RecreateSimpleObjects extends FixtureScript {
public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz", public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz",
"Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo")); "Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo"));
public RecreateSimpleObjects() {
withDiscoverability(Discoverability.DISCOVERABLE);
}
// region > number (optional input) // region > number (optional input)
private Integer number; private Integer number;
// endregion
// region > simpleObjects (output)
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
public RecreateSimpleObjects() {
withDiscoverability(Discoverability.DISCOVERABLE);
}
/** /**
* The number of objects to create, up to 10; optional, defaults to 3. * The number of objects to create, up to 10; optional, defaults to 3.
*/ */
@ -50,12 +55,7 @@ public class RecreateSimpleObjects extends FixtureScript {
this.number = number; this.number = number;
return this; return this;
} }
// endregion
// region > simpleObjects (output)
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
/** /**
* The simpleobjects created by this fixture (output). * The simpleobjects created by this fixture (output).
*/ */

View File

@ -44,18 +44,22 @@ public class Spell extends BaseEntity {
private String name; private String name;
@Id
@GeneratedValue
@Column(name = "SPELL_ID")
private Long id;
@ManyToOne
@JoinColumn(name = "SPELLBOOK_ID_FK", referencedColumnName = "SPELLBOOK_ID")
private Spellbook spellbook;
public Spell() {} public Spell() {}
public Spell(String name) { public Spell(String name) {
this(); this();
this.name = name; this.name = name;
} }
@Id
@GeneratedValue
@Column(name = "SPELL_ID")
private Long id;
public Long getId() { public Long getId() {
return id; return id;
} }
@ -63,11 +67,7 @@ public class Spell extends BaseEntity {
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
@ManyToOne
@JoinColumn(name = "SPELLBOOK_ID_FK", referencedColumnName = "SPELLBOOK_ID")
private Spellbook spellbook;
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -48,29 +48,11 @@ import com.iluwatar.servicelayer.wizard.Wizard;
@Table(name = "SPELLBOOK") @Table(name = "SPELLBOOK")
public class Spellbook extends BaseEntity { public class Spellbook extends BaseEntity {
public Spellbook() {
spells = new HashSet<>();
wizards = new HashSet<>();
}
public Spellbook(String name) {
this();
this.name = name;
}
@Id @Id
@GeneratedValue @GeneratedValue
@Column(name = "SPELLBOOK_ID") @Column(name = "SPELLBOOK_ID")
private Long id; private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
private String name; private String name;
@ManyToMany(mappedBy = "spellbooks", fetch = FetchType.EAGER) @ManyToMany(mappedBy = "spellbooks", fetch = FetchType.EAGER)
@ -79,6 +61,24 @@ public class Spellbook extends BaseEntity {
@OneToMany(mappedBy = "spellbook", orphanRemoval = true, cascade = CascadeType.ALL) @OneToMany(mappedBy = "spellbook", orphanRemoval = true, cascade = CascadeType.ALL)
private Set<Spell> spells; private Set<Spell> spells;
public Spellbook() {
spells = new HashSet<>();
wizards = new HashSet<>();
}
public Spellbook(String name) {
this();
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -45,6 +45,16 @@ import com.iluwatar.servicelayer.spellbook.Spellbook;
@Table(name = "WIZARD") @Table(name = "WIZARD")
public class Wizard extends BaseEntity { public class Wizard extends BaseEntity {
@Id
@GeneratedValue
@Column(name = "WIZARD_ID")
private Long id;
private String name;
@ManyToMany(cascade = CascadeType.ALL)
private Set<Spellbook> spellbooks;
public Wizard() { public Wizard() {
spellbooks = new HashSet<>(); spellbooks = new HashSet<>();
} }
@ -53,12 +63,7 @@ public class Wizard extends BaseEntity {
this(); this();
this.name = name; this.name = name;
} }
@Id
@GeneratedValue
@Column(name = "WIZARD_ID")
private Long id;
public Long getId() { public Long getId() {
return id; return id;
} }
@ -66,12 +71,7 @@ public class Wizard extends BaseEntity {
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
private String name;
@ManyToMany(cascade = CascadeType.ALL)
private Set<Spellbook> spellbooks;
public String getName() { public String getName() {
return name; return name;
} }