use of com.iluwatar.servicelayer.magic.MagicServiceImpl in project java-design-patterns by iluwatar.
the class App method queryData.
/**
* Query the data
*/
public static void queryData() {
MagicService service = new MagicServiceImpl(new WizardDaoImpl(), new SpellbookDaoImpl(), new SpellDaoImpl());
LOGGER.info("Enumerating all wizards");
for (Wizard w : service.findAllWizards()) {
LOGGER.info(w.getName());
}
LOGGER.info("Enumerating all spellbooks");
for (Spellbook s : service.findAllSpellbooks()) {
LOGGER.info(s.getName());
}
LOGGER.info("Enumerating all spells");
for (Spell s : service.findAllSpells()) {
LOGGER.info(s.getName());
}
LOGGER.info("Find wizards with spellbook 'Book of Idores'");
List<Wizard> wizardsWithSpellbook = service.findWizardsWithSpellbook("Book of Idores");
for (Wizard w : wizardsWithSpellbook) {
LOGGER.info("{} has 'Book of Idores'", w.getName());
}
LOGGER.info("Find wizards with spell 'Fireball'");
List<Wizard> wizardsWithSpell = service.findWizardsWithSpell("Fireball");
for (Wizard w : wizardsWithSpell) {
LOGGER.info("{} has 'Fireball'", w.getName());
}
}
Aggregations