public class ObjectFactory extends Object
Modifier and Type | Method and Description |
---|---|
static Properties |
getObjectProperties(Object object)
Gets the properties of an object as a
Properties object. |
static void |
setPropertiesOnObject(Object object,
Properties properties)
Sets the attributes of an object according to the properties provided.
|
static Object |
summonInstance(String className,
Properties properties)
Creates an instance of the given class and configures its properties.
|
public static void setPropertiesOnObject(Object object, Properties properties) throws IllegalAccessException, InvocationTargetException
object
- Object on which the properties should be set.properties
- Properties that should be set as properties of the object. Key is a name of an object property and value is its value.InvocationTargetException
- When it was not possible to call the setter on the object.IllegalAccessException
- When we did not have the correct rights to set any of the properties.public static Object summonInstance(String className, Properties properties) throws InstantiationException, IllegalAccessException, ClassNotFoundException, InvocationTargetException
className
- Name of the class to be constructed.properties
- Properties to be configured on the class instance.InstantiationException
- When it was not possible to create the object instance.IllegalAccessException
- When we did not have correct rights to create the object or set any of its properties.ClassNotFoundException
- When the given class does not exists.InvocationTargetException
- When it was not possible to call any of the properties setters.public static Properties getObjectProperties(Object object) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
Properties
object.object
- The object to be inspected.IllegalAccessException
- When it was not possible to find, call, or use any of the getter methods.NoSuchMethodException
- When it was not possible to find, call, or use any of the getter methods.InvocationTargetException
- When it was not possible to find, call, or use any of the getter methods.Copyright © 2010–2017 PerfCake Community. All rights reserved.