/** * Reads action path from class. If the class is annotated with {@link MadvocAction} annotation, * class action path will be read from annotation value. Otherwise, action class path will be built from the * class name. This is done by removing the package name and the last contained word * (if there is more then one) from the class name. Such name is finally uncapitalized. */ protected String[] readClassActionPath(final Class actionClass) { // read class annotation MadvocAction madvocActionAnnotation = ((Class<?>)actionClass).getAnnotation(MadvocAction.class); String classActionPath = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null; if (StringUtil.isEmpty(classActionPath)) { classActionPath = null; } String actionClassName = actionClass.getSimpleName(); actionClassName = StringUtil.uncapitalize(actionClassName); actionClassName = MadvocUtil.stripLastCamelWord(actionClassName); // removes 'Action' from the class name if (classActionPath == null) { classActionPath = actionClassName; } return ArraysUtil.array(actionClassName, classActionPath); }
MadvocAction madvocActionAnnotation = actionPackage.getAnnotation(MadvocAction.class); packageActionPathFromAnnotation = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null;
/** * Reads action path from class. If the class is annotated with {@link MadvocAction} annotation, * class action path will be read from annotation value. Otherwise, action class path will be built from the * class name. This is done by removing the package name and the last contained word * (if there is more then one) from the class name. Such name is finally uncapitalized. * <p> * If this method returns <code>null</code> class will be ignored. */ protected String readClassActionPath(Class actionClass) { // read annotation MadvocAction madvocActionAnnotation = ((Class<?>)actionClass).getAnnotation(MadvocAction.class); String classActionPath = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null; if (StringUtil.isEmpty(classActionPath)) { classActionPath = null; } String name = actionClass.getSimpleName(); name = StringUtil.uncapitalize(name); name = MadvocUtil.stripLastCamelWord(name); // decide if (classActionPath == null) { classActionPath = name; } else { classActionPath = StringUtil.replace(classActionPath, REPL_CLASS, name); } return classActionPath; }
String packageActionPath = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null; if (StringUtil.isEmpty(packageActionPath)) { packageActionPath = null;