1700481352
1700481353
}catch(IOException e){
1700481354
1700481355
//TODO Auto-generated catch block
1700481356
1700481357
e.printStackTrace();
1700481358
1700481359
}
1700481360
1700481361
List<File>dirs=new ArrayList<File>();
1700481362
1700481363
while(resources.hasMoreElements()){
1700481364
1700481365
URL resource=resources.nextElement();
1700481366
1700481367
dirs.add(new File(resource.getFile()));
1700481368
1700481369
}
1700481370
1700481371
ArrayList<Class>classes=new ArrayList<Class>();
1700481372
1700481373
for(File directory:dirs){
1700481374
1700481375
classes.addAll(findClasses(directory,packageName));
1700481376
1700481377
}
1700481378
1700481379
return classes;
1700481380
1700481381
}
1700481382
1700481383
private static List<Class>findClasses(File directory,String packageName){
1700481384
1700481385
List<Class>classes=new ArrayList<Class>();
1700481386
1700481387
if(!directory.exists()){
1700481388
1700481389
return classes;
1700481390
1700481391
}
1700481392
1700481393
File[]files=directory.listFiles();
1700481394
1700481395
for(File file:files){
1700481396
1700481397
if(file.isDirectory()){
1700481398
1700481399
assert!file.getName().contains(”.”);
1700481400
1700481401
classes.addAll(findClasses(file,packageName+”.”+file.getName()));
[
上一页 ]
[ :1.700481352e+09 ]
[
下一页 ]