You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2008/04/14 22:23:05 UTC

[jira] Commented: (LANG-417) ClassUtils: method for turning FQN into resource path

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

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

I've got some new thoughts:
@Matt: java.lang.Package seems to be the right class, indeed. So I think we should use it.

We've defined three different types of resources, but only one of them actually involves the Package.
It would make more sense to use some sort of ResourceUtil.
{code}
public String toResourcePath(String fqName)
public String toResourcePath(Package context, String fqName) //you could use aClass.getPackage()
public String toResourcePath(Class context, String fqName)
{code}
Personally I hate Strings as a result, because it can be anything. But it's probably the best solution here.
I don't think URL is a good solution: it's not part of java.lang or java.util, but java.net so I don't think it should be part of commons-lang.


> 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: 3.0
>
>
> 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.