/** * Get the definition class. * @param project the current project. * @return the type of the definition. */ public Class<?> getTypeClass(Project project) { try { return innerGetTypeClass(); } catch (NoClassDefFoundError ncdfe) { project.log("Could not load a dependent class (" + ncdfe.getMessage() + ") for type " + name, Project.MSG_DEBUG); } catch (ClassNotFoundException cnfe) { project.log("Could not load class (" + className + ") for type " + name, Project.MSG_DEBUG); } return null; }
/** * Return true if this Resource is selected. * @param r the Resource to check. * @return whether the Resource was selected. * @throws BuildException if an error occurs. */ public boolean isSelected(Resource r) { if ((clazz == null) == (type == null)) { throw new BuildException(ONE_ONLY); } Class<?> c = clazz; if (type != null) { if (project == null) { throw new BuildException( "No project set for InstanceOf ResourceSelector; the type attribute is invalid."); } AntTypeDefinition d = ComponentHelper.getComponentHelper( project).getDefinition(ProjectHelper.genComponentName(uri, type)); if (d == null) { throw new BuildException("type %s not found.",type); } try { c = d.innerGetTypeClass(); } catch (ClassNotFoundException e) { throw new BuildException(e); } } return c.isAssignableFrom(r.getClass()); }
clazz = def.innerGetTypeClass(); } catch (ClassNotFoundException e) { jars = true;