Package com.logicaldoc.core.automation
Class ClassTool
java.lang.Object
com.logicaldoc.core.automation.ClassTool
Utility functions for manipulating classes and resources and for other
 programming language aspects
- Since:
- 7.5.1
- Author:
- Marco Meschieri - LogicalDOC
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionMakes a copy(clone) of a given object instance.Class<?> Retrieves the class specificationbooleanChecks if a given string is null or emptybooleanChecks if a given instance is nullnewInstance(String className) Creates a new instance of a class whose constructor does not have parameters
- 
Constructor Details- 
ClassToolpublic ClassTool()
 
- 
- 
Method Details- 
newInstancepublic Object newInstance(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException Creates a new instance of a class whose constructor does not have parameters- Parameters:
- className- name of the class, if the class is inside the package com.logicaldoc you can just avoid the prefix, e.g.: for com.logicaldoc.stamp.automation.StampTool you can simply use stamp.automation.StampTool)
- Returns:
- the instantiated object
- Throws:
- InstantiationException- the class does not have a constructor without parameters
- IllegalAccessException- the class or the constructor is private or not visible
- ClassNotFoundException- you specified an unexisting class
- SecurityException- the specified class cannot be instantiated due to security constraints
- NoSuchMethodException- no public constructor without parameters
- InvocationTargetException- the constructor raised an exception
- IllegalArgumentException- no public constructor without parameters
 
- 
forNameRetrieves the class specification- Parameters:
- className- name of the class, if the class is inside the package com.logicaldoc you can just avoid the prefix, e.g.: for com.logicaldoc.stamp.automation.StampTool you can simply use stamp.automation.StampTool)
- Returns:
- the class object
- Throws:
- ClassNotFoundException- you specified an unexisting class
 
- 
isNullChecks if a given instance is null- Parameters:
- instance- the object to evaluate
- Returns:
- true only if the passed instance is null
 
- 
isEmptyChecks if a given string is null or empty- Parameters:
- str- the string to evaluate
- Returns:
- true only if the passed string is null or empty
 
- 
copyMakes a copy(clone) of a given object instance.
 Attention: for security reasons it will not be used the cloned() method of the given objet but a new instance of the given object's class is invoked by passing the same instance. As a result they may be copied only those objects that define a public construction that accepts the same class as single argument. - Parameters:
- instance- the object to clone
- Returns:
- the cloned object
 
 
-