Package com.iizix.prop
Class PreloadClientCacheResource
- java.lang.Object
- com.iizix.prop.PreloadClientCacheResource
- Direct Known Subclasses:
FontFilePreloadClientCacheResource
public abstract class PreloadClientCacheResource extends java.lang.Object
Class holding information for a single resource that should be preloaded to the client cache when the application starts.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description static PreloadClientCacheResource[]
EMPTY
An empty array of resources.
Constructor Summary
Constructors Constructor Description PreloadClientCacheResource(PropCnr owner, java.lang.String path)
Constructs the resource.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract long
getModificationTime()
Returns the modification time of the resource.PropCnr
getOwner()
Gets the owner property.java.lang.String
getPath()
Gets the path to the resource used for the client side.abstract long
getSize()
Returns the size of the resource in bytes.boolean
isRelevant(IClientSessionGyro clientGyro)
Verifies if this resource is of relevant use for the client.
Field Detail
EMPTY
public static final PreloadClientCacheResource[] EMPTY
An empty array of resources.
Constructor Detail
PreloadClientCacheResource
public PreloadClientCacheResource(PropCnr owner, java.lang.String path)
Constructs the resource.- Parameters:
owner
- The owner property.path
- The resource path for the client as "module$/path/filename.ext".
Method Detail
getOwner
public PropCnr getOwner()
Gets the owner property.- Returns:
- The property containing the asset reference.
getPath
public java.lang.String getPath()
Gets the path to the resource used for the client side.- Returns:
- The relative path of the resource in the form of "module$/path/filename.ext".
isRelevant
public boolean isRelevant(IClientSessionGyro clientGyro)
Verifies if this resource is of relevant use for the client. This call makes it possible to verify the client browser or alike to check if a resource is needed (e.g. a font icon resource of WOFF2 may only be required in particular cases, whereas the WOFF type may be required for the other clients).- Parameters:
clientGyro
- The client gyro instance, initialized with client side information.- Returns:
- true If the resource is relevant, false otherwise. The default is to return true.
getSize
public abstract long getSize()
Returns the size of the resource in bytes.- Returns:
- The size, or -1 if resource is not found.
getModificationTime
public abstract long getModificationTime()
Returns the modification time of the resource.- Returns:
- The modification time, or zero if resource is not found.