public class ObjFactory extends Object
Typical use is something like:
import com.example.interfaces.DrinkingEstablishment;
import com.example.interfaces.Beer;
...
// Typically these would be populated from some Java properties file
String barName = "com.example.foo.Bar";
String beerBrand = "com.example.brewery.Guiness";
...
DrinkingEstablishment bar = ObjFactory.make(barName, "DrinkingEstablishment");
Beer beer = ObjFactory.make(beerBrand, "Beer");
bar.drink(beer); // Drink a Guiness beer at the foo Bar. :)
...
Copyright (c) 2009 - The OWASP Foundation
public static <T> T make(String className, String typeName) throws ConfigurationException
className parameter.className - The name of the class to construct. Should be a fully qualified name and
generally the same as type TtypeName - A type name used in error messages / exceptions.className, which is cast to type T.ConfigurationException - thrown if class name not found in class path, or does not
have a public, no-argument constructor, or is not a concrete class, or if it is
not a sub-type of T (or T itself). Usually this is
caused by a misconfiguration of the class names specified in the ESAPI.properties
file. Also thrown if the CTOR of the specified className throws
an Exception of some type.Copyright © 2016 The Open Web Application Security Project (OWASP). All rights reserved.