gr.uoa.di.madgik.commons.configuration.utils
Class ClassWrapper

java.lang.Object
  extended by gr.uoa.di.madgik.commons.configuration.utils.ClassWrapper

public class ClassWrapper
extends java.lang.Object

Utility class that can instantiate and call methods of some class through reflection

Author:
gpapanikos

Field Summary
 java.lang.Object Instance
          The instance created
 java.lang.Class<?> ModuleClass
          The class loaded
 
Constructor Summary
ClassWrapper(java.util.Map<java.lang.String,IParameter> Params)
          Creates a new instance
 
Method Summary
 void Instantiate(java.lang.String ModuleName, Constructor ConstructorToUse)
          Creates a new instance of the provided class
 void Invoke(Method MethodToInvoke)
          Invokes a method of the created instance if the class was instantiated or a static method if no instantiation was performed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Instance

public java.lang.Object Instance
The instance created


ModuleClass

public java.lang.Class<?> ModuleClass
The class loaded

Constructor Detail

ClassWrapper

public ClassWrapper(java.util.Map<java.lang.String,IParameter> Params)
Creates a new instance

Parameters:
Params - The parameters that are available and can be used to retrieve and set values
Method Detail

Instantiate

public void Instantiate(java.lang.String ModuleName,
                        Constructor ConstructorToUse)
                 throws java.lang.Exception
Creates a new instance of the provided class

Parameters:
ModuleName - The class that should be instantiated
ConstructorToUse - The constructor of the class to use
Throws:
java.lang.Exception - The instantiation could not be performed

Invoke

public void Invoke(Method MethodToInvoke)
            throws java.lang.Exception
Invokes a method of the created instance if the class was instantiated or a static method if no instantiation was performed

Parameters:
MethodToInvoke - The method to invoke
Throws:
java.lang.Exception - The invocation could not be performed