org.xanot.structure
Class CreateInstanceRule

java.lang.Object
  extended by org.xanot.structure.XanotRule
      extended by org.xanot.structure.CreateInstanceRule

public class CreateInstanceRule
extends XanotRule

Create instance rule. This rule define what class should be instantiated when it encounters an xml element start.

Author:
Ferdinand Neman (newm4n _at_ gmail.com)

Constructor Summary
CreateInstanceRule(java.lang.String path, java.lang.Class baseClass)
          Creates a new CreateInstanceRule object.
 
Method Summary
 java.lang.Object createInstance()
          Create an object instance based on the base class
 java.lang.Class getBaseClass()
          Get the class to instantiate
 boolean isRepeatable()
          Check wether the base class can be nested inside the same or child of this class
 boolean isRoot()
          Check wether the base class is the root class.
 void setBaseClass(java.lang.Class baseClass)
          Set the class to instantiate
 void setRepeatable(boolean repeatable)
          Determine wether the base class can be nested inside the same or child of this class
 void setRoot(boolean root)
          Determine wether the base class is the root class.
 java.lang.String toString()
          Get string representation of this object.
 
Methods inherited from class org.xanot.structure.XanotRule
getPath, setPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CreateInstanceRule

public CreateInstanceRule(java.lang.String path,
                          java.lang.Class baseClass)
Creates a new CreateInstanceRule object.

Parameters:
path - Path name, should be equals to the xml open tag name.
baseClass - The class to instantiate
Method Detail

getBaseClass

public java.lang.Class getBaseClass()
Get the class to instantiate

Returns:
Returns the baseClass.

setBaseClass

public void setBaseClass(java.lang.Class baseClass)
Set the class to instantiate

Parameters:
baseClass - The baseClass to set.

createInstance

public java.lang.Object createInstance()
                                throws java.lang.InstantiationException,
                                       java.lang.IllegalAccessException
Create an object instance based on the base class

Returns:
Instance
Throws:
java.lang.InstantiationException - Thrown when instantiating class.
java.lang.IllegalAccessException - Thrown when the class is not legally accessed.

isRoot

public boolean isRoot()
Check wether the base class is the root class.

Returns:
Returns the root.

setRoot

public void setRoot(boolean root)
Determine wether the base class is the root class.

Parameters:
root - The root to set.

isRepeatable

public boolean isRepeatable()
Check wether the base class can be nested inside the same or child of this class

Returns:
Returns the repeatable.

setRepeatable

public void setRepeatable(boolean repeatable)
Determine wether the base class can be nested inside the same or child of this class

Parameters:
repeatable - The repeatable to set.

toString

public java.lang.String toString()
Get string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String representation.


Copyright 2006 null. All Rights Reserved.