@Test public void extractJavaFileName_class_TestMe_in_subpackage_com_daimler_sechub_reflections() { File file = new File("."); File sourceFolder = new File(file, "subproject1/src/main/java"); File classFile = new File(sourceFolder, "com/daimler/sechub/reflections/TestMe.java"); String result = reflectionsToTest.extractJavaFileName(sourceFolder, classFile); assertEquals("com.daimler.sechub.reflections.TestMe", result); }
String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; }
Reflections { String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; } }
Reflections { String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; } Reflections(); }
Reflections { String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; } Reflections(); Set<Class<?>> getTypesAnnotatedWith(Class<? extends Annotation> annotation); Set<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation); Set<Field> getFieldsAnnotatedWith(Class<? extends Annotation> annotation); Set<Class<? extends T>> getSubTypesOf(Class<T> clazz); boolean isInspecting(Class<?> clazz); int getAmountOfInspectedClasses(); }
Reflections { String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; } Reflections(); Set<Class<?>> getTypesAnnotatedWith(Class<? extends Annotation> annotation); Set<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation); Set<Field> getFieldsAnnotatedWith(Class<? extends Annotation> annotation); Set<Class<? extends T>> getSubTypesOf(Class<T> clazz); boolean isInspecting(Class<?> clazz); int getAmountOfInspectedClasses();  }