1 9 package org.openuss.presentation.layoutformatter; 10 11 import java.lang.reflect.*; 12 13 14 20 public class LayoutFormatterFactory { 21 26 public static LayoutFormatter getLayoutFormatter(Object stateObject, 27 String fullClassNameLayout) 28 throws Exception { 29 Class objectClass = Class.forName(fullClassNameLayout); 31 32 Class myOwner = Class.forName("java.lang.Object"); 34 Class [] parameterTypes = new Class [1]; 35 parameterTypes[0] = myOwner; 36 37 Constructor objectConstructor = objectClass.getConstructor( 38 parameterTypes); 39 40 Object [] initArgs = new Object [1]; 42 initArgs[0] = stateObject; 43 44 LayoutFormatter layoutFormatter = (LayoutFormatter) objectConstructor.newInstance( 45 initArgs); 46 47 return layoutFormatter; 48 } 49 } | Popular Tags |