1 19 20 package org.polepos.teams.jdo; 21 22 import java.lang.reflect.*; 23 24 25 public class Jdo { 26 27 private final static JdoSettings sSettings = new JdoSettings(); 28 29 public static JdoSettings settings() { 30 return sSettings; 31 } 32 33 37 public static void main(String [] args) { 38 39 40 if(args == null || args.length == 0){ 41 System.out.println("Supply the class"); 42 } 43 44 enhanceObjectDB(); 45 } 46 47 51 private static void enhanceObjectDB(){ 52 53 String clazz = "com.objectdb.Enhancer"; 54 String method = "enhance"; 55 Class [] types = new Class [] {String .class}; 56 Object [] params = new Object [] {"org.polepos.teams.jdo.data.*" }; 57 58 try{ 59 callByReflection(clazz, method, types, params); 60 }catch(Exception e){ 61 System.out.println("ObjectDB libraries are not included"); 62 e.printStackTrace(); 63 } 64 } 65 66 private static void callByReflection(String enhancerClass, String enhancerMethod, Class [] parameterTypes, Object [] parameters) throws ClassNotFoundException , SecurityException , NoSuchMethodException , IllegalArgumentException , IllegalAccessException , InvocationTargetException{ 67 Class clazz = Class.forName(enhancerClass); 68 Method method = clazz.getMethod(enhancerMethod, parameterTypes); 69 method.invoke(null, parameters); 70 } 71 72 73 } 74 | Popular Tags |