net.sf.sdedit.util
Class ObjectFactory

java.lang.Object
  extended by net.sf.sdedit.util.ObjectFactory

public final class ObjectFactory
extends Object

Utility class for creating objects from strings.

Author:
Markus Strauch

Method Summary
static Object createFromString(Class<?> cls, String string)
          Creates an instance of some class from a string by calling the string constructor of the class with the string as a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createFromString

public static Object createFromString(Class<?> cls,
                                      String string)
Creates an instance of some class from a string by calling the string constructor of the class with the string as a parameter.

Parameters:
cls - the class of which an instance is to be created, if it is a primitive type, an instance of the corresponding class will be created
string - the string from which the instance is to be created ornull, then an instance resulting from an invokation of the no-argument constructor will be returned
Returns:
an instance of cls, created from string


Copyright © 2011. All Rights Reserved.