public interface Resource
Resources may be either base or localized. A localized
version of a base resource may be obtained
via getLocalization(Locale)
.
Resource locations are used as Map keys, they must
implement Object.hashCode()
and
Object.equals(java.lang.Object)
properly.
Resource locations are valid even if the corresponding
resource doesn't exist. To verify if a localization
actually exists, use getResourceURL()
, which returns
null if the resource doesn't exist. getLocalization(Locale)
returns only real resource locations, where the resource exists.
Folders must be represented with a trailing slash.
Modifier and Type | Method and Description |
---|---|
java.util.Locale |
getLocale()
Returns the locale for which this resource has been localized
or null if the resource has not been localized.
|
Resource |
getLocalization(java.util.Locale locale)
Returns a localized version of this resource (or this resource, if no
appropriate localization is found).
|
java.lang.String |
getName()
Returns the file name portion of the resource location.
|
java.lang.String |
getPath()
Returns the path that represents the resource.
|
Resource |
getRelativeResource(java.lang.String name)
Returns at a relative location to this resource.
|
java.net.URL |
getResourceURL()
Returns a URL for the resource.
|
java.net.URL getResourceURL()
java.lang.String getName()
Resource getLocalization(java.util.Locale locale)
locale
- to localize for, or null for no localization.Resource getRelativeResource(java.lang.String name)
getResourceURL()
.name
- name of new resource, possibly as a relative path, or
as an absolute path (starting with a slash).java.lang.String getPath()
java.util.Locale getLocale()