Configurators - AlexGPlay/Blynder GitHub Wiki

A configurator is a special class that can set the internals of the application and some window customization. You can create your own configurator if you implement the IConfigurator interface, you can also extend from BasicConfigurator or use the CustomConfigurator methods, this last one is the expected one to be used for this purposes.

Now the real question is, what can I do with this? That is a complex question, but in an easy way, you can change how the application works, the framework maps a lot of classes and later in the execution has to look for them and create another mappings, this internal mappings and findings can be changed if you want, for that you can extends from the interface that does that job and after that create a configurator that uses it.

For example, if you want to change how the classes are searched when the application first starts, you can implement the IClassFinder and implement your own behaviour, for the example we will extend the base class instead of the interface and add some behaviour to the existing one.

public class ClassFinderV2 extends ClassFinder{
	public List<Class<?>> findClasses() throws ClassNotFoundException{
		System.out.println("Starting the process");
		super.findClasses();
		System.out.println("Ending the process");
	}
}

Now we have our own implementation of the class finding process, how do we use it? Easy, create a configurator that can do that.

public class MainClass{
	public static void main(String[] args){
		CustomConfigurator config = new CustomConfigurator().with(new ClassFinderV2());
		...
	}
}

Now we have our own configurator, we just have to tell the application to use it, that is an easy one too.

public class MainClass{
	public static void main(String[] args){
		CustomConfigurator config = new CustomConfigurator().with(new ClassFinderV2());
		Application.launchApp(config);
	}
}

You can use the configurator for easier tasks, for example, setting the window title, changing the icon or setting the default size.

public class MainClass{
	public static void main(String[] args){
		WindowSize size = new WindowSize(250,250);
		WindowProps props = new WindowProps("Title", "icon.png");

		CustomConfigurator config = new CustomConfigurator().with(size).with(props);
		Application.launchApp(config);
	}
}

We now have our own behaviour for the application class finder, with this process we can change many processes of the framework, the interfaces listed below have an explanation in their javadoc that can be used for the implementation.

  • IAutowiredFinder
  • IBeanFinder
  • IClassFinder
  • IControllerFinder
  • IRoutesFinder
  • IAutowiredMapper
  • IControllerMapper
  • IFilterFinder
  • IFilterMapper
  • Browser
  • WindowSize
  • WindowProps
⚠️ **GitHub.com Fallback** ⚠️