/** * Class to resource. * * @param clazz the clazz * * @return the string * * @deprecated use {@link #toResource(Class)} */ public static String classToResource(final Class<?> clazz) { return classToResource(clazz.getName()); }
/** * To resource. * * @param clazz the clazz * * @return the string */ public static String toResource(final Class<?> clazz) { return classToResource(clazz.getName()); }
/** * To resource. * * @param clazz * the clazz * * @return the string */ public static String toResource(final Class<?> clazz) { return classToResource(clazz.getName()); }
/** * @see ClasspathMonitorMBean#getNoClasses(java.lang.String) */ public int getNoClasses(final String classname) { return getNoResources(Converter.classToResource(classname)); }
/** * Returns the jar file or path where the given classname was found. * * @param classname e.g. java.lang.String * * @return jar or path as URI */ public URI whichClassPath(final String classname) { String resource = Converter.classToResource(classname); return whichResourcePath(resource); }
/** * Gets the doublet. * * @param clazz the clazz * @param nr the nr * * @return the doublet */ public URL getDoublet(final Class<?> clazz, final int nr) { String resource = Converter.classToResource(clazz.getName()); return getDoublet(resource, nr); }
/** * Which class. * * @param name the classname * @return the URI * @see patterntesting.runtime.monitor.ClasspathMonitorMBean#whichClass(java.lang.String) */ @Override public URI whichClass(final String name) { String resource = Converter.classToResource(name); return classpathDigger.whichResource(resource); }
/** * Returns the jar file or path where the given classname was found. * * @param classname * e.g. java.lang.String * * @return jar or path as URI */ public URI whichClassPath(final String classname) { String resource = Converter.classToResource(classname); return whichResourcePath(resource); }
/** * Which class jar. * * @param classname * the classname * * @return the jar file */ public JarFile whichClassJar(final String classname) { String resource = Converter.classToResource(classname); return whichResourceJar(resource); }
/** * Which class jar. * * @param classname the classname * * @return the jar file */ public JarFile whichClassJar(final String classname) { String resource = Converter.classToResource(classname); return whichResourceJar(resource); }
/** * Gets the doublet. * * @param clazz * the clazz * @param nr * the nr * @return the doublet */ public URI getDoublet(final Class<?> clazz, final int nr) { String resource = Converter.classToResource(clazz.getName()); return this.getDoublet(resource, nr); }
/** * Gets the no classes. * * @param classname * the classname * @return number of classes * @see ClasspathMonitorMBean#getNoClasses(String) */ @Override public int getNoClasses(final String classname) { return ResourcepathMonitor.getInstance().getNoResources(Converter.classToResource(classname)); }
/** * Is the given class a doublet, i.e. can it be found more than once in the * classpath? * * @param clazz the class to be checked * * @return true if class is found more than once in the classpath * * @throws NoSuchElementException if class is not found in the classpath */ @ProfileMe public boolean isDoublet(final Class<?> clazz) { String classname = clazz.getName(); String resource = Converter.classToResource(classname); return isDoublet(resource); }
if (doublet == null) { String classname = clazz.getName(); String resource = Converter.classToResource(classname); try { doublet = isDoublet(resource);
/** * Which class. * * @param name the name * * @return the URI * * @see patterntesting.runtime.monitor.ClasspathMonitorMBean#whichClass(java.lang.String) */ @ProfileMe public URI whichClass(final String name) { String resource = Converter.classToResource(name); return whichResource(resource); }
continue; String resource = Converter.classToResource(clazz.getName()); Enumeration<URL> resources = getResources(resource); try {
/** * Looks for each doublet if it has a different doublets. For the * performance reason it looks in the incompatibleClassList from the last * time if it is already found. This is done because normally the number of * incompatible classed does not decrease. * * @return a sorted list of incompatible classes */ @ProfileMe public synchronized List<Class<?>> getIncompatibleClassList() { List<Class<?>> doublets = this.getDoubletList(); for (Class<?> clazz : doublets) { if (incompatibleClassList.contains(clazz)) { continue; } String resource = Converter.classToResource(clazz.getName()); Enumeration<URL> resources = getResources(resource); URL url = (URL) resources.nextElement(); ArchivEntry archivEntry = new ArchivEntry(url); while (resources.hasMoreElements()) { url = (URL) resources.nextElement(); ArchivEntry doubletEntry = new ArchivEntry(url); if (archivEntry.equals(doubletEntry)) { incompatibleClassList.add(clazz); break; } } } return incompatibleClassList; }