Added code comments.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.iluwatar.magic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.iluwatar.spell.Spell;
|
||||
@@ -9,6 +10,11 @@ import com.iluwatar.spellbook.SpellbookDao;
|
||||
import com.iluwatar.wizard.Wizard;
|
||||
import com.iluwatar.wizard.WizardDao;
|
||||
|
||||
/**
|
||||
*
|
||||
* Service implementation.
|
||||
*
|
||||
*/
|
||||
public class MagicServiceImpl implements MagicService {
|
||||
|
||||
private WizardDao wizardDao;
|
||||
@@ -35,4 +41,17 @@ public class MagicServiceImpl implements MagicService {
|
||||
public List<Spell> findAllSpells() {
|
||||
return spellDao.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Wizard> findWizardsWithSpellbook(String name) {
|
||||
Spellbook spellbook = spellbookDao.findByName(name);
|
||||
return new ArrayList<Wizard>(spellbook.getWizards());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Wizard> findWizardsWithSpell(String name) {
|
||||
Spell spell = spellDao.findByName(name);
|
||||
Spellbook spellbook = spell.getSpellbook();
|
||||
return new ArrayList<Wizard>(spellbook.getWizards());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user