use of com.duangframework.core.annotation.mvc.Service in project duangframework by tcrct.
the class AutoBuildServiceInterface method createBatchInterface.
/**
* 批量创建Service类接口文件到指定目录下
* @param interFaceDirPath 存放RPC接口文件的目录
* @param customizeDir 自定义目录
* @return
* @throws Exception
*/
public static boolean createBatchInterface(String interFaceDirPath, String customizeDir) throws Exception {
Map<Class<?>, Object> serviceMap = BeanUtils.getAllBeanMaps().get(Service.class.getSimpleName());
if (ToolsKit.isEmpty(serviceMap)) {
throw new EmptyNullException("serviceMap is null");
}
try {
for (Iterator<Class<?>> iterator = serviceMap.keySet().iterator(); iterator.hasNext(); ) {
Class<?> clazz = iterator.next();
String packagePath = RpcUtils.getRpcPackagePath(customizeDir);
createInterface(clazz, interFaceDirPath, packagePath);
}
return true;
} catch (Exception e) {
logger.warn(e.getMessage(), e);
throw new RpcException("batch create service interface is fail: " + e.getMessage(), e);
}
}
Aggregations