public abstract class ResourceReference extends Object implements org.apache.wicket.util.io.IClusterable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceReference.Key
A (re-usable) data store for all relevant ResourceReference data
|
static class |
ResourceReference.LambdaResourceReference |
static class |
ResourceReference.UrlAttributes |
| Constructor and Description |
|---|
ResourceReference(Class<?> scope,
String name)
Creates new
ResourceReference instance. |
ResourceReference(Class<?> scope,
String name,
Locale locale,
String style,
String variation)
Creates new
ResourceReference instance. |
ResourceReference(ResourceReference.Key key)
Creates new
ResourceReference instance. |
ResourceReference(String name)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeRegistered()
Can be used to disable registering certain resource references in
ResourceReferenceRegistry. |
boolean |
equals(Object obj) |
List<HeaderItem> |
getDependencies() |
String |
getExtension()
returns extension of the resource reference
|
ResourceReference.Key |
getKey() |
Locale |
getLocale() |
String |
getName() |
abstract IResource |
getResource()
Returns the resource.
|
Class<?> |
getScope() |
String |
getStyle() |
ResourceReference.UrlAttributes |
getUrlAttributes()
Allows to specify which locale, style and variation values will the generated URL for this
resource reference have.
|
String |
getVariation() |
int |
hashCode() |
static 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.
|
static 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.
|
String |
toString() |
public ResourceReference(ResourceReference.Key key)
ResourceReference instance.key - The data making up the resource referencepublic ResourceReference(Class<?> scope, String name, Locale locale, String style, String variation)
ResourceReference instance.scope - mandatory parametername - mandatory parameterlocale - resource localestyle - resource stylevariation - resource variationpublic ResourceReference(Class<?> scope, String name)
ResourceReference instance.scope - mandatory parametername - mandatory parameterpublic ResourceReference(String name)
name - resource namepublic final ResourceReference.Key getKey()
public String getName()
public final String getExtension()
null if there is no
extensionpublic Class<?> getScope()
public Locale getLocale()
public String getStyle()
public String getVariation()
public boolean canBeRegistered()
ResourceReferenceRegistry.true if this reference can be registered, false otherwise.public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public abstract IResource getResource()
public ResourceReference.UrlAttributes getUrlAttributes()
public static final ResourceReference of(String name, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier)
name - The name to use with the resourceresourceSupplier - Lambda supplier to build the resourcepublic static final ResourceReference of(ResourceReference.Key key, org.danekja.java.util.function.serializable.SerializableSupplier<IResource> resourceSupplier)
key - The ResourceReference.Key to use with the resourceresourceSupplier - Lambda supplier to build the resourcepublic List<HeaderItem> getDependencies()
Copyright © 2006–2018 Apache Software Foundation. All rights reserved.