Java Annotation attached to new objects?
Is it possible to attach an annotation to a new object?
Let's say we have a simple house object, House house = new House ()
and annotations @Large and @Spooky.
My idea was to have a switch statement so a house marked as @Spooky does something different than a house marked as @Large.
@Spooky
House house = new House();
System.out.println(house.getClass().getAnnotations().length);
Apparently there is no annotation on my new house object as length == 0.
Why is that?