commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-417) ClassUtils: method for turning FQN into resource path
Date Mon, 10 Mar 2008 19:30:46 GMT

    [ https://issues.apache.org/jira/browse/LANG-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577134#action_12577134
] 

Robert Scholte commented on LANG-417:
-------------------------------------

Maybe this requires a PackageUtils, because it's got nothing to do with the class itself but
just with it's package.

I think the most logic method would be 
public static String toResourcePath(Package p)...
public static String toResourcePath(Package p, String fqName) ...

this has to be combined with: 
public static Package getPackage(Class clazz)

and yes, this would mean a new class: Package.

although it would require 2 steps, the methods would be very clear. IMHO the suggested methodnames
are just too ugly.




> ClassUtils: method for turning FQN into resource path
> -----------------------------------------------------
>
>                 Key: LANG-417
>                 URL: https://issues.apache.org/jira/browse/LANG-417
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> I commonly need a FQ path to a resource within the same location as a class file. I recommend
the addition of this method:
> public String getPackageResourcePath(Class clazz, String resourceName)
>     StringBuffer buf = new StringBuffer();
>     buf.append(ClassUtils.getPackageName(getClass()).replace('.', '/'));
>     buf.append("/");
>     buf.append(resourceName);
>     return  buf.toString();
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message