Thanks for this article, nicely written and discusses a great concept. I read through the Java SDK documentation to only find that most of the get and put methods in this API are abstract. If I didn't read your article I would have assumed that someone would need to implement this class before I can go ahead and use it. So I would have to look for a provider and then use some system property to plug their implementation in JRE to be able to use it. There is no such thing, however. As you have shown that anyone can just use the API by using methods that return a Pref. Object and do operations on it. Is this normal for any API defined in the SDK - that it already comes with a default implementation regardless of the classes defined as abstract? I am having some difficulty understand this concept. If a classâ?? functions are declared abstract donâ??t you have to subclass it (usually you would use a different class name) to implement its methods and then instantiate the subclass to use the functionality. I hopefully have made my question clear.
Also, how would I change the default backing store e.g. on windows: How would I choose not to use the registry keys but use SQL server for instance or much simpler, just a flat file( If I didn't want to use Properties file in latter case).
Preference APIjiber January 11, 2012 at 10:51 AM
Thanks for this article, nicely written and discusses a great concept. I read through the Java SDK documentation to only find that most of the get and put methods in this API are abstract. If I didn't read your article I would have assumed that someone would need to implement this class before I can go ahead and use it. So I would have to look for a provider and then use some system property to plug their implementation in JRE to be able to use it. There is no such thing, however. As you have shown that anyone can just use the API by using methods that return a Pref. Object and do operations on it. Is this normal for any API defined in the SDK - that it already comes with a default implementation regardless of the classes defined as abstract? I am having some difficulty understand this concept. If a classâ?? functions are declared abstract donâ??t you have to subclass it (usually you would use a different class name) to implement its methods and then instantiate the subclass to use the functionality. I hopefully have made my question clear. Also, how would I change the default backing store e.g. on windows: How would I choose not to use the registry keys but use SQL server for instance or much simpler, just a flat file( If I didn't want to use Properties file in latter case).
Post your Comment