A basic java back end framework that follows the model view paradigm.
This framework gives the user the ability to set, get and register to receive updates for any attribute of the user's desire. The user can decide to be completely type safe by using the Attribute Object to key into the model or just use strings and be responsible for your own casting but flexibility and lose some verbosity.
Using the IModel interface is extremely simple and can done as follows:
IModel model = new IModel(); Attribute attr = new Attribute<Integer>("some_int", Integer.class); model.set(attr, 5); int fetch_number = model.get(attr); System.out.println("Value returned from model was " + fetch_number);
Here is a simple example of doing the same thing without using the Attribute class
IModel model = new IModel(); model.set("some_integer", 5); int fetch_number = (int)model.get("some_integer"); System.out.println("Value returned from model was " + fetch_number);
Be aware that the model will not protect you from a ClassCastException when used in this way so its up to the user to be aware of what types they are putting into the model.