Exposing a Live Object using Reflection Classes
A powerful core feature of Uncle Unc is the ability to wrap any live java object as an Uncle Unc Item. This uses the java reflection APIs to expose properties and methods of the object as Uncle Unc properties and methods that can be directly inspected and manipulated in a GUI.
There are implementations for doing this in the ulu.view.sys.refl package, using both inheritance and the Shaper interface. The latter is the preferred way of working now, with the inheritance-based approach being deprecated.
When we pass a reference to any live Object to an ObjectShaper, we can automatically expose properties and methods in an intelligent way. For example:
- bean getters and setters are exposed as properties
- array properties, and methods returning arrays, are presented as child views
- methods, properties and bean properties can be bound to the Item so that it is
automatically updated as the underlying Object changes
The ObjectShaper contains pluggable PropertyShaper and MethodShaper types that provide flexibility in how properties and methods are mapped. The next step in this direction is to allow XML files, say, to define arbitrary patterns of fine-grained control over how and what gets exposed. In principle, onvce this is in place, something as complex as the javax.mail package could be mapped to Uncle Unc without writing any bespoke java code, whether as a Shaper or a subclass of Item. This approach wouldn't fit all back-end services, but would provide a rapid way of prototyping, at the least.

