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 Object

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

Author:
gpapanikos

Field Summary
 Object Instance
          The instance created
 Class<?> ModuleClass
          The class loaded
 
Constructor Summary
ClassWrapper(Map<String,IParameter> Params)
          Creates a new instance
 
Method Summary
 void Instantiate(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Instance

public Object Instance
The instance created


ModuleClass

public Class<?> ModuleClass
The class loaded

Constructor Detail

ClassWrapper

public ClassWrapper(Map<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(String ModuleName,
                        Constructor ConstructorToUse)
                 throws 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:
Exception - The instantiation could not be performed

Invoke

public void Invoke(Method MethodToInvoke)
            throws 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:
Exception - The invocation could not be performed


Copyright © 2013. All Rights Reserved.