Documentation API of the 'umontreal.iro.lecuyer.util.ClassFinder' Java class

Class ClassFinder

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class ClassFinderextends Objectimplements Cloneable, Serializable
    Utility class used to convert a simple class name to a fully qualified class object. The Class class can be used to obtain information about a class (its name, its fields, methods, constructors, etc.), and to construct objects, even if the exact class is known at runtime only. It provides a forName static method converting a string to a Class, but the given string must be a fully qualified name.

    Sometimes, configuration files may need to contain Java class names. After they are extracted from the file, these class names are given to forName to be converted into Class objects. Unfortunately, only fully qualified class names will be accepted as input, which clutters configuration files, especially if long package names are used. This class permits the definition of a set of import declarations in a way similar to the Java Language Specification. It provides methods to convert a simple class name to a Class object and to generate a simple name from a Class object, based on the import rules.

    The first step for using a class finder is to construct an instance of this class. Then, one needs to retrieve the initially empty list of import declarations by using getImports, and update it with the actual import declarations. Then, the method findClass can find a class using the import declarations. For example, the following code retrieves the class object for the List class in package java.util

    ClassFinder cf = new ClassFinder();
       cf.getImports().add ("java.util.*");
       Class<?> listClass = cf.findClass ("List");
    See Also:
    Serialized Form

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.