dimanche 13 septembre 2015

How to access declared variables in an annotation? [duplicate]

This question already has an answer here:

    @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