Project Home JavaDoc API Downloads Mailing List Featured
Java Container - sandbox on demand as easy as it can get
Class Marshaling - a mobile code on the tip of your finger
Fikin Ant Tasks - a directory of wonderful libraries
Search:
Donate to this project Statistics of this project RSS feeds of this project |
POJO StateThis is a library for observing state of Plain Old Java Object (POJO). It does provide an uniformed API to inspect Java objects for their internal state (based on Java Reflection API) and displays the information in different output formats (e.g. text, xml and html).
All source code is released under :
Apache License V2
Latest release and changes :
WHATSNEW
Installation instructions :
INSTALL
If you feel generous, donate and be honored forever :
Donate
If you feel like business, sign up a maintenance contract and be privileged :
Sign-Up
If you feel cool, buy a t-shirt and make a statement :
T-shirt
If you feel like hacking, send me a patch :
Submit patch
If you feel nothing like it don't panic, drink water and hangover will soon be over
Some years ago I was working on an application where I wanted to display the
internal state of the application in an HTML interface. Thinks like how long
has it been up, what it is doing now and so forth.
Typicaly this would be solved by coding a Servlet (or JSP) visualizing
the underlying object model as required.
Three thinks were worring me though. First there was that wish of mine to be able to change the object model without having to edit the Servlet or HTML code. Second, I didn't want anyhting fancy, showing all data in a tabular format would be acceptable. Third, I had the feeling that observing my object model was part of a bigger use case, the one which you can look into an object, determine which are its state-representative methods and display them in a user friendly manner. All this lead to creation of this library. If you think about Model-View-Controller (MVC) paradigm, the Model is your object model, the View is this library and the Controller is your integration code. POJO State is a generic library which can decorate any Java object with user friendly information about its state. Imagine a Java Bean where all or some getter methods reveal information about its state. This library will provide you with the means to display their content in XML, HTML or simple TEXT tabular format. Further on, it will provide you with means to replace the method names with user friendly names and allow you to add description to them. It will also format the actual method values in their proper human readble format (dates, time, numbers, price info and such). Finally, if already avaialable functionality is not enough one can utilize the API to extend it in any required direction.
Typical usage scenario is:
where:
Here is one simple example, observing the state of a custom defined object:
which will print out table in the format:
And few more possibilities:
Before you start using the library, you have to sort out few questions:
Once you figure these questions out you're ready to start coding!
Decorators:
SnapshotDecotar creates State object capable of
taking all Property values upon update.
DynamicDecorator creates State object capable of
executing and formatting underlying java.lang.Method each time
Property.getValue() is called.
Selectors: BeanSelector is selecting all getter methods.ResourceBundleSelector is accepting a resource file with
all-to-be-recognized methods listed in.Formatters: All java.text.Format implementations are accepted.
©2006-2007 Nikolay Fiykov
|