Java Resource Path Get classToResource(String className)

Here you can find the source of classToResource(String className)

Description

class To Resource

License

Open Source License

Declaration

public static String classToResource(String className) 

Method Source Code

//package com.java2s;
/*/*w w w.  j  a v a2  s.co  m*/
 * Copyright (c) 2015, Parallel Universe Software Co. All rights reserved.
 * 
 * This program and the accompanying materials are licensed under
 * GNU General Public License, version 2, with the Classpath Exception
 * 
 * http://openjdk.java.net/legal/gplv2+ce.html
 */

public class Main {
    private static final String CLASS_FILE_NAME_EXTENSION = ".class";

    public static String classToResource(String className) {
        if (className == null)
            return null;
        return className.replace('.', '/') + CLASS_FILE_NAME_EXTENSION;
    }

    public static String classToResource(Class<?> clazz) {
        if (clazz == null)
            return null;
        return classToResource(clazz.getName());
    }
}

Related

  1. deserialize(Class parentOfResource, String resourcePath, Class targetClass)
  2. existsResource(String pathName)
  3. getAbsolutePathFromResource(Class reference, String resource)
  4. getAbsoluteResource(String path)