1 6 7 package com.hp.hpl.jena.rdf.model.impl; 8 9 import java.lang.reflect.Constructor ; 10 11 import com.hp.hpl.jena.rdf.model.*; 12 import com.hp.hpl.jena.shared.JenaException; 13 14 21 public class ModelSpecCreatorByClassname implements ModelSpecCreator 22 { 23 protected static final Class [] constructorArguments = new Class [] { Resource.class, Model.class }; 24 25 Constructor c; 26 String className; 27 28 public ModelSpecCreatorByClassname( String className ) 29 { this.className = className; } 30 31 public ModelSpec create( Resource root, Model desc ) 32 { 33 try 34 { Object [] arguments = new Object [] { root, desc }; 35 if (c == null) c = Class.forName( className ).getDeclaredConstructor( constructorArguments ); 36 return (ModelSpec) c.newInstance( arguments ); } 37 catch (Exception e) 38 { throw new JenaException( e ); } 39 } 40 } 41 42 | Popular Tags |