Package net.didion.jwnl.util.factory
Interface Installable
- All Known Implementing Classes:
AbstractCachingDictionary
,DatabaseBackedDictionary
,Dictionary
,FileBackedDictionary
,MapBackedDictionary
public interface Installable
An
Installable
is an object that defines a framework for allowing
subclasses to define an instance of themselves as the single static
instance of the superclass. It is required that subclasses implement
the install() method which creates an instance of the class from
property file parameters (Param
s) and installs it.
For example:
public abstract class Super implements Installable { private static Super INSTANCE; private String str; protected void setInstance(Super instance) { INSTANCE = instance; } public Super getInstance() { return INSTANCE; } protected Super() { } protected Super(String str) { this.str = str; } // other methods go here } public class Sub extends Super { public Sub() { } protected Sub(String s) { super(s); } public void install(Map params) { Param p = params.get("string"); Sub sub = new Sub(p.getValue()); setInstance(sub); } // other methods go here } public static void main(String[] args) { Map params = getParams(); Sub.class.newInstance().install(params); }A class that implements this interface must also define a no-arg constructor.
-
Method Summary
-
Method Details
-
install
- Throws:
JWNLException
-