This question already has an answer here:
- Retrieve JAVA Annotation Attribute 3 answers
@AlienBossPreProcess(bossID = 1,
bossAge = 23,
bossInhabitance = AlienHabitance.MARS,
bossName = "Sythe",
bossType = AlienType.SCARY,
bossWeight = 67,
bossAbility = BossAbility.SUMMON_ALIENS_II
)
public class AlienBoss_Sythe implements AlienBoss
{
@Override
public void useAbility(BossAbility ability)
{
}
@Override
public void useAllAbilities()
{
}
}
So I learned about annotations today and created one. It defines characteristics of an "alien boss". However, when I try to check the BossAbility value of the bossAbility variable, it seems as if it was never defined. How do I get values declared in an annotation? Does it require reflection?
Aucun commentaire:
Enregistrer un commentaire