2009-06-24 4 views
2

J'ai une classe de commodité pour encoder les URI. J'ai créé trois méthodes que j'utilise en fonction de la spécificité que je dois avoir. Je me demande s'il y a une façon intelligente de réutiliser les descriptions @param dans ce cas en utilisant JavaDoc? (Je n'en ai trouvé aucun)Est-il possible de réutiliser les descriptions @param dans JavaDoc?

public class URLCreator { 
    public static String getURLString(String host, int port, String path) { 
     return getURLString("http", host, port, path, null); 
    } 
    public static String getURLString(String scheme, String host, int port, String path) { 
     return getURLString(scheme, host, port, path, null); 
    } 
    public static String getURLString(String scheme, String host, int port, String path, String fragment) { 
     try { 
      URI uri = new URI(scheme, null, host, port, path, null, fragment); 
      return uri.toString(); 
     } catch (URISyntaxException e) { 
      throw new RuntimeException(e); 
     } 
    } 
} 
+1

double question: http://stackoverflow.com/questions/7021696/javadoc-reusable-parameter-values ​​ –

+0

@MarkButler celui-ci est beaucoup plus concis et plus facile à lire cependant, mais vous avez raison – Hilikus

Répondre

0

N ° La copie fonctionne pour les méthodes surchargées, mais pas pour les surcharges. http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javadoc.html#inheritingcomments

+0

Eh oui, je connaître le comportement d'héritage. Je le choisis comme réponse préférée pour le "Non" partie. :-) –

+0

Essayez la balise @see: http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#[email protected] –

Questions connexes