com.togethersoft.openapi.util
Class ResourceUtil


public class ResourceUtil

Presents utilites to retrieve some information for specified Class.
For example : class name, package name, class path an so on.

Author:
TogetherSoft
Since: Together 4.0

Field Summary
 private final static StringFILE
           
 private final static StringJAR
           
 private final static StringJAR_DELIMITER
           
 private final static StringPROTOCOL_DELIMITER
           
 private final static StringSYSTEMRESOURCE
           
 private final static StringSYSTEMRESOURCE_DELIMITER
           
 private final static StringSYSTEMRESOURCE_FILE_MARKER
           
 private final static StringSYSTEMRESOURCE_ZIP_MARKER
           

Method Summary
 private static FileextractRoot(URL resourceURL, String resourcePath)
          Attempts to extract classpath entry part from passed URL.
 private static StringgetAbsoluteResourcePath(Class context, String resourcePath)
           
 static StringgetModuleHomeDirectory(Class moduleClass)
           
 static StringgetPackageName(Class clazz)
          Detects package name without class name.
 static FilegetResource(Class context, String path)
          Combines convertToFile with Class.findResource() and contains
workarounds to some known findResource() bugs
 static FilegetResourceRoot(Class context, String path)
          Attempts to detect classpath entry which contains given resource
 static StringgetShortName(Class clazz)
          Detects class name without package specification (short name).

Field Detail

FILE

private final static String FILE

JAR

private final static String JAR

JAR_DELIMITER

private final static String JAR_DELIMITER

PROTOCOL_DELIMITER

private final static String PROTOCOL_DELIMITER

SYSTEMRESOURCE

private final static String SYSTEMRESOURCE

SYSTEMRESOURCE_DELIMITER

private final static String SYSTEMRESOURCE_DELIMITER

SYSTEMRESOURCE_FILE_MARKER

private final static String SYSTEMRESOURCE_FILE_MARKER

SYSTEMRESOURCE_ZIP_MARKER

private final static String SYSTEMRESOURCE_ZIP_MARKER
Method Detail

extractRoot

private static File extractRoot(URL resourceURL, String resourcePath)
Attempts to extract classpath entry part from passed URL.

getAbsoluteResourcePath

private static String getAbsoluteResourcePath(Class context, String resourcePath)

getModuleHomeDirectory

public static String getModuleHomeDirectory(Class moduleClass)

getPackageName

public static String getPackageName(Class clazz)
Detects package name without class name.
Returns: Package name if detected, otherwise empty String.

getResource

public static File getResource(Class context, String path)
Combines convertToFile with Class.findResource() and contains
workarounds to some known findResource() bugs
See Also:
java.lang.Class#findResource, #convertToFile

getResourceRoot

public static File getResourceRoot(Class context, String path)
Attempts to detect classpath entry which contains given resource

getShortName

public static String getShortName(Class clazz)
Detects class name without package specification (short name).
Returns: Short name or full name if package not specified.

Association Links

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String