public interface IInit
This interface is thought to be used with Factory
.
Although it can be used in others situations, where you
create a object of unknow class y you need initiate it.
A possible example of use:
IInit obj = (IInit) myClass.newInstance(); obj.init("obj");The object that implements this interface generally have a default constructor, and you initiate the object with
init(java.lang.String)
.Modifier and Type | Method and Description |
---|---|
void |
init(java.lang.String name)
Initiate the object.
|
void init(java.lang.String name) throws InitException
The init process must to be in this metho, and not in
constructor.
It possible to specefy a name, thus you can have
different configurations in the same object type.
This name can be used to read a properties file, with
if/else or another technique.
name
- Identifier name used on init. Can be null.InitException
- Some problem on initiate.