[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-tabpanelfocusedCommentId=13874644#comment-13874644 ] Benedikt Ritter commented on LANG-417: -- I'm not sure whether {{toAbsoluteName}} is a good method name. I always associate absolute with the file system root. 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 Components: lang.* Reporter: Paul Benedict Assignee: Benedikt Ritter Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13874712#comment-13874712 ] Woonsan Ko commented on LANG-417: - Good point. {{ClasspathUtils}} seems better to me because many frameworks have used 'classpath:' url scheme already and so 'ClasspathUtils' seems connected to that to me. Also, I wasn't fully happy with 'toAbsoluteName' either even though it was copied from the javadoc. So, how about this then? The names are longer, but it looks clearer than 'AbsoluteResource[Name|Path]' to me. :-) {code} public class ClasspathUtils { public static String toFullyQualifiedResourceName(Package context, name); public static String toFullyQualifiedResourceName(Class context, name); } {code} 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 Components: lang.* Reporter: Paul Benedict Assignee: Benedikt Ritter Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13874865#comment-13874865 ] Benedikt Ritter commented on LANG-417: -- This sounds good to me. What do [~paul4christ79] and [~bayard] think? 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 Components: lang.* Reporter: Paul Benedict Assignee: Benedikt Ritter Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13874934#comment-13874934 ] Paul Benedict commented on LANG-417: Good names. I approve. 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 Components: lang.* Reporter: Paul Benedict Assignee: Benedikt Ritter Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13869100#comment-13869100 ] Benedikt Ritter commented on LANG-417: -- I like Woosan's way of going back to original request. Also I like the idea of having {{ResourceUtils}}. 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 Components: lang.* Reporter: Paul Benedict Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13869101#comment-13869101 ] Benedikt Ritter commented on LANG-417: -- I'd like to have this in 3.3 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 Components: lang.* Reporter: Paul Benedict Assignee: Benedikt Ritter Fix For: 3.3, Patch Needed I commonly need a FQ path to a resource within the same location as a class file. I recommend the addition of this method: {code:java} 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(); } {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[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-tabpanelfocusedCommentId=13802060#comment-13802060 ] Woonsan Ko commented on LANG-417: - I'd like to suggest the following: {code} public class ResourceUtils { public static String toAbsoluteResourceName(Package context, name); public static String toAbsoluteResourceName(Class context, name); } {code} According to the original description above, he just wanted to replace a resource name by an absolute resource name. e.g, [ com.example.Hello.class, 'HelloMessage.properties' ] - 'com/example/HelloMessage.properties'. In this sense, URL doesn't seem to be proper. URL is likely to have something like 'file:///...', which is different from the original request. I assume he wanted to use something like ClassLoader#getResource() in the end. Also, the suggested api, toResourcePath(String fqName), doesn't seem to be necessary in this sense. By the way, I think we'd better use 'AbsoluteResourceName' instead of 'ResourcePath' because the former one is similar to the javadoc explanation in java.lang.Class#getResource(name) (quote: Before delegation, an *absolute resource name* is constructed from the given resource name using this algorithm), and 'path' may sound confusing because the return value doesn't represent a full (file) path at all. Just my two cents, Woonsan 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 Components: lang.* Reporter: Paul Benedict Fix For: Patch Needed 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 was sent by Atlassian JIRA (v6.1#6144)
[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-tabpanelfocusedCommentId=12677851#action_12677851 ] Henri Yandell commented on LANG-417: PackageUtils sounds good. Code something Paul :) 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.
[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-tabpanelfocusedCommentId=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.
[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-tabpanelfocusedCommentId=12577262#action_12577262 ] Paul Benedict commented on LANG-417: If this necessitates a PackageUtils, then bump to 3.0. 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.
[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-tabpanelfocusedCommentId=12576704#action_12576704 ] Paul Benedict commented on LANG-417: This method may be better named as getClasspathResourcePath 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.