Interface Controller

    • Field Detail

      • REGISTERED_CONTROLLERS

        static final HashMap<Class<? extends Controllable>,​Class<? extends Controller>> REGISTERED_CONTROLLERS
        Map that saves the Controllers registered for a Controllable and associates them
    • Method Detail

      • register

        static void register​(Class<? extends Controllable> controllable,
                             Class<? extends Controller> controller)
        Registers a Controller class for the factory method of(Controllable) and assigns it to a Controllable class.
        Parameters:
        controllable - Controllable class to which the Controller class is assigned
        controller - Controller class that is registered
      • of

        static Controller of​(Controllable c)
        Factory method that creates and returns a new Controller for the given Controllable.

        Note that the registered Controller must have a public Constructor that takes the Controllable as the only parameter.

        A suitable Controller can only be returned if a suitable value pair is available in the Map REGISTERED_CONTROLLERS. A Controllable can be assigned a Controller with the method register(Class, Class).

        Parameters:
        c - Controllable, which should be given a function by the new Controller
        Returns:
        new Controller that is bound to the Controllable or null if no Controller has been registered
        Since:
        Bitchanger 0.1.4
        See Also:
        register(Class, Class)
      • ofArg

        static Controller ofArg​(Controllable c,
                                Object... args)
        Factory method that creates and returns a new Controller for the given Controllable.

        Note that the registered Controller must have a public constructor that takes the Controllable as the first argument and also receives all other transferred Objects in the same order as given.

        A suitable Controller can only be returned if a suitable value pair is available in the Map REGISTERED_CONTROLLERS. A Controllable can be assigned a Controller with the method register(Class, Class).

        Parameters:
        c - Controllable, which should be given a function by the new Controller
        args - Arguments in the order they are required by the constructor
        Returns:
        new Controller that is bound to the Controllable or null if no Controller has been registered
        Since:
        Bitchanger 0.1.4
        See Also:
        register(Class, Class)
      • setActions

        void setActions()
        Sets all functions that are needed for the view.