Java Properties

Java Properties provides an efficient way to access bean-like properties of Java objects.
Download

Java Properties Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Trapdoor
  • Publisher web site:
  • http://www.trapdoor.org/prj_properties.php

Java Properties Tags


Java Properties Description

Java Properties provides an efficient way to access bean-like properties of Java objects. Java Properties provides an efficient way to access bean-like properties of Java objects.In a nutshell, provides an efficient way to access bean-like properties of java objects. Unlike java bean properties, a chain of properties can be specified efficiently, allowing convenient access to properties of nested domain objects.Runtime class-generation and caching can be used very easily to obviate the need for reflection, without losing the flexibility it provides.Class Properties It also provides classes which manipulate objects at runtime by using strings to address conceptual variables (think bean properties) in a similar fashion to the java reflection mechanisms. Class Property example Say we have the following classes: public class Order { ... public Customer getCustomer() { ... } ...}public class Customer { ... public Address getAddress() { ... } ...}public class Address { ... public String getLine1() { ... } public String getLine2() { ... } ...}Now, we could do this to access line 1 of the address: result = order.getCustomer().getAddress().getLine1();But what if there are nulls? What if we want to compare the first line of the address from two different orders? Whith properties this is really simple: ClassProperty p = PropertyManager.getProperty(Order.class,"Customer:Address:Line1",true); result = p.getValue(order);The idea is simple enough - you use the string "Customer:Address:Line1" to specify a series of getXXX calls. Importantly, it the library handles nulls for you, returning null if any of the objects in the chain are null. Note, this is not simply a wrapper around java reflection, since it includes non-reflective optimizations by making use of the cojen library to generate class files at runtime to acces these properties. The real benefit lies in being able to specify which properties you wish to access at runtime. You can even pass this ability on to the users of your library or application. Unlike reflection, class files are generated for the properties, and these files are cached - which means once you have specified a property once, further uses of the same property don't use reflection and are very fast.Property API vs Java Bean Properties. The property API models accessor/mutator method pairs as conceptual variables called properties. The approach used is similar to, but more flexible than java bean properties, and more performant than reflection if runtime class generation is used. Unlike java bean properties, a chain or path of properties can be specified (and more importantly, turned into bytecode using runtime generation) to traverse a complex tree of objects. It is simple to create applications portable between different security environments - using runtime generation where allowed, and falling back to reflection where security is tighter.Dynamic Class Management. The properties package also provides classes to handle the loading (and unloading/reloading) of classes at runtime. It provides a framework useful for dynamically loading runtime-generated classes, for example. While the property API can happily ignore the dynamic loading framework, it can also make use of it to enable runtime class generation.


Java Properties Related Software