Interface IInit


  • public interface IInit
    With the posibility of be initiated.

    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).
    Author:
    Javier Paniza
    • Method Detail

      • init

        void init​(java.lang.String name)
           throws InitException
        Initiate the object.

        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.

        Parameters:
        name - Identifier name used on init. Can be null.
        Throws:
        InitException - Some problem on initiate.