2015-05-05 11 views

cevap

2

Kolayca değil. Bir süre önce yolumu kesmeyi başardım (hiçbir scala know-how). Bu kodu gönderirim belki kullanımda olabilir.

public static List<String[]> parseRoutes() { 
    scala.Option<play.core.Router.Routes> option = Play.application().getWrappedApplication().routes(); 
    if (option.isDefined()) { 
     play.core.Router.Routes routes = option.get(); 
     scala.collection.Seq<scala.Tuple3<String, String, String>> doc = routes.documentation(); 
     scala.collection.Iterator<scala.Tuple3<String, String, String>> it = doc.iterator(); 

     List<String[]> listOfRoutes = new ArrayList<String[]>(); 

     while(it.hasNext()) { 
      scala.Tuple3<String, String, String> tuple = it.next(); 
      //tuple._1() is the method and tuple._2() the url... tuple._3() is the controller name 
      String[] route = {tuple._1(), tuple._2()}; 
      listOfRoutes.add(route); 
      Logger.debug("route -> " + Arrays.toString(route)); 
     } 
     return listOfRoutes; 
    } 
    return null; 
} 

bir The method iterator() is ambiguous for the type Seq<Tuple3<String,String,String>> gösteren .iterator() endişe etmeyin. Oyunda sadece iyi derler.

İlgili konular