/** * (REQUIRED) * set this to the class name (e.g. org.project.MyClass) * and it will be converted into the class object * @param persistentClassname this is the fully qualified classname of the persistent type */ public void setPersistentClassname(String persistentClassname) { persistentType = ClassLoaderUtils.getClassFromString(persistentClassname); if (persistentType == null) { throw new IllegalArgumentException( "Invalid class name for persistentClassname, could not create class from string: " + persistentClassname); } } /* (non-Javadoc)
public Class<?> convert(Object value) { String className = value.toString(); Class<?> c = ClassLoaderUtils.getClassFromString(className); if (c == null) { throw new UnsupportedOperationException("Class convert failure: cannot convert source ("+value+") and type ("+value.getClass()+") to a Class"); } return c; }
public Class<?> convert(Object value) { String className = value.toString(); Class<?> c = ClassLoaderUtils.getClassFromString(className); if (c == null) { throw new UnsupportedOperationException("Class convert failure: cannot convert source ("+value+") and type ("+value.getClass()+") to a Class"); } return c; }
/** * Set the list of persistent classes that this DAO will handle<br/> * This no longer requires this to be set before the class initializes * Do this using Spring like so: * <xmp> <property name="persistentClasses"> <list> <value>org.sakaiproject.*yourappname*.model.*YourObject*</value> </list> </property> * </xmp> * @param classes a list of Strings representing the * the fully qualified classpath and classname of persistent objects */ public void setPersistentClasses(List<String> classes) { if (classes.size() == 0) { throw new IllegalArgumentException("persistent class list must have at least one item"); } List<Class<?>> classList = new ArrayList<Class<?>>(); for (Iterator<String> i = classes.iterator(); i.hasNext();) { String className = i.next(); Class<?> c = ClassLoaderUtils.getClassFromString(className); if (c == null) { throw new IllegalArgumentException( "Invalid class type in list of persistent classes: " + className); } classList.add(c); } this.classes = classList; }
Class<?> dynaBean = ClassLoaderUtils.getClassFromString(DYNABEAN_CLASSNAME); if (dynaBean != null) { Class<?> adapterClass = ClassLoaderUtils.getClassFromString(path); if (adapterClass == null) { System.err.println("WARN: Could not find adapter class: " + path + ", will continue without the dynabean adapter");
Class<?> dynaBean = ClassLoaderUtils.getClassFromString(DYNABEAN_CLASSNAME); if (dynaBean != null) { Class<?> adapterClass = ClassLoaderUtils.getClassFromString(path); if (adapterClass == null) { System.err.println("WARN: Could not find adapter class: " + path + ", will continue without the dynabean adapter");