java.lang.Object
org.apache.wicket.request.resource.ResourceReference
- All Implemented Interfaces:
Serializable
,IClusterable
- Direct Known Subclasses:
ConcatResourceBundleReference
,ContextRelativeResourceReference
,FileSystemResourceReference
,PackageResourceReference
,ResourceBundleReference
,ResourceReference.LambdaResourceReference
,SharedResourceReference
,TextTemplateResourceReference
,UrlResourceReference
Reference to a resource. Can be used to reference global resources.
Even though resource reference is just a factory for resources, it still needs to be identified
by a globally unique identifier, combination of scope
and name
. Those
are used to generate URLs for resource references. locale
, style
and
variation
are optional fields to allow having specific references for individual
locales, styles and variations.
- Author:
- Matej Knopp, Juergen Donnerstag
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A (re-usable) data store for all relevant ResourceReference datastatic final class
static class
-
Constructor Summary
ConstructorDescriptionResourceReference
(Class<?> scope, String name) Creates newResourceReference
instance.Creates newResourceReference
instance.ResourceReference
(String name) Construct.Creates newResourceReference
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Can be used to disable registering certain resource references inResourceReferenceRegistry
.boolean
final String
returns extension of the resource referencefinal ResourceReference.Key
getKey()
getName()
abstract IResource
Returns the resource.Class<?>
getScope()
getStyle()
Allows to specify which locale, style and variation values will the generated URL for this resource reference have.int
hashCode()
static final ResourceReference
of
(String name, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier) Factory method to build a resource reference that uses the provided supplier to return the resource.static final ResourceReference
of
(ResourceReference.Key key, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier) Factory method to build a resource reference that uses the provided supplier to return the resource.toString()
-
Constructor Details
-
ResourceReference
Creates newResourceReference
instance.- Parameters:
key
- The data making up the resource reference
-
ResourceReference
public ResourceReference(Class<?> scope, String name, Locale locale, String style, String variation) Creates newResourceReference
instance.- Parameters:
scope
- mandatory parametername
- mandatory parameterlocale
- resource localestyle
- resource stylevariation
- resource variation
-
ResourceReference
Creates newResourceReference
instance.- Parameters:
scope
- mandatory parametername
- mandatory parameter
-
ResourceReference
Construct.- Parameters:
name
- resource name
-
-
Method Details
-
getKey
- Returns:
- Gets the data making up the resource reference. They'll be use by ResourceReferenceRegistry to make up the key under which the resource reference gets stored.
-
getName
- Returns:
- name
-
getExtension
returns extension of the resource reference- Returns:
- extension of the resource's name in lower-case or
null
if there is no extension
-
getScope
- Returns:
- scope
-
getLocale
- Returns:
- locale
-
getStyle
- Returns:
- style
-
getVariation
- Returns:
- variation
-
canBeRegistered
Can be used to disable registering certain resource references inResourceReferenceRegistry
.- Returns:
true
if this reference can be registered,false
otherwise.
-
equals
-
hashCode
-
getResource
Returns the resource.- Returns:
- resource instance
-
getUrlAttributes
Allows to specify which locale, style and variation values will the generated URL for this resource reference have.- Returns:
- url attributes
-
of
public static final ResourceReference of(String name, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier) Factory method to build a resource reference that uses the provided supplier to return the resource.- Parameters:
name
- The name to use with the resourceresourceSupplier
- Lambda supplier to build the resource- Returns:
- the new resource reference
-
of
public static final ResourceReference of(ResourceReference.Key key, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier) Factory method to build a resource reference that uses the provided supplier to return the resource.- Parameters:
key
- TheResourceReference.Key
to use with the resourceresourceSupplier
- Lambda supplier to build the resource- Returns:
- the new resource reference
-
toString
-
getDependencies
- Returns:
- the resources this ResourceReference depends on.
-