Defining a Java class as with annotation