Skip to content

Annotations Metaprogramming

Almas Baimagambetov edited this page Aug 4, 2017 · 5 revisions

For the annotation processor to work properly the package name must be present and it must not contain uppercase letters.

@AddCollisionHandler

Classes annotated with @AddCollisionHandler are automatically registered as collision handlers.

@AddCollisionHandler
class PlayerPowerupHandler extends CollisionHandler {
    ...
}

@SetEntityFactory

The class annotated with @SetEntityFactory is set as the main entity factory.

@SetEntityFactory
class MyEntityFactory implements EntityFactory {

}

@OnUserAction

Indicates that a method is called when user triggers an action. The method signature must be public void anyName().

@OnUserAction(name = "Move Left")
public void moveLeft() {
    ...
}

@Handles

@Spawns

@SpawnSymbol

Clone this wiki locally