Package com.complexible.common.base
Class Resources2
java.lang.Object
com.complexible.common.base.Resources2
- Since:
- 2.0
- Version:
- 2.0
- Author:
- Michael Grove
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URLgetResource(Class<?> theClass, String theResource) Get a resource from the file path specified by the resource name and if that file does not exist, check within the class path, first in the location of the specified class, and then if not found, at the root.
-
Constructor Details
-
Resources2
public Resources2()
-
-
Method Details
-
getResource
Get a resource from the file path specified by the resource name and if that file does not exist, check within the class path, first in the location of the specified class, and then if not found, at the root. If the resource is not found for any reason, null is returned.
getResource(MyClass.class, "myprops.properties")will first check for the File "myprops.properties" if that does not exist, then MyClass.getResource("myprops.properties") is checked, and finally if it's still not found, MyClass.getResource("/myprops.properties") will be checked.- Parameters:
theClass- the class whose classpath the resource might be located intheResource- the name of the resource to get the location of- Returns:
- the URL to the resource or null if not found
-