Package com.helger.photon.app.resource
Class WebSiteResourceWithCondition
java.lang.Object
com.helger.photon.app.resource.WebSiteResourceWithCondition
This encapsulates a
WebSiteResource together with an optional
conditional comment.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionWebSiteResourceWithCondition(EWebSiteResourceType eType, String sPath, Charset aCharset, String sConditionalComment, boolean bIsBundlable, com.helger.css.media.ICSSMediaList aMediaList) ConstructorprotectedWebSiteResourceWithCondition(WebSiteResource aResource, String sConditionalComment, boolean bIsBundlable, com.helger.css.media.ICSSMediaList aMediaList) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if this resource can be bundled with the passed resource.static WebSiteResourceWithConditioncreateForCSS(com.helger.html.resource.css.ICSSPathProvider aPP, boolean bRegular) Factory method for CSS resources.static WebSiteResourceWithConditioncreateForCSS(String sPath, String sConditionalComment, boolean bIsBundlable, com.helger.css.media.ICSSMediaList aMediaList) static WebSiteResourceWithConditioncreateForJS(com.helger.html.resource.js.IJSPathProvider aPP, boolean bRegular) Factory method for JavaScript resources.static WebSiteResourceWithConditioncreateForJS(String sPath, String sConditionalComment, boolean bIsBundlable) booleancom.helger.html.resource.css.ConstantCSSPathProvidercom.helger.html.resource.js.ConstantJSPathProvidercom.helger.css.media.ICSSMediaListbooleaninthashCode()booleanCheck if this resource can be bundled, independent of the conditional comment.toString()
-
Constructor Details
-
WebSiteResourceWithCondition
public WebSiteResourceWithCondition(@Nonnull EWebSiteResourceType eType, @Nonnull @Nonempty String sPath, @Nonnull Charset aCharset, @Nullable String sConditionalComment, boolean bIsBundlable, @Nullable com.helger.css.media.ICSSMediaList aMediaList) Constructor- Parameters:
eType- Resource type. May not benull.sPath- Path to the resource. May neither benullnor empty.aCharset- Charset to read the file contents. May not benull.sConditionalComment- Optional conditional comment.bIsBundlable-trueif this resource can be bundled. Usetrueif you are unsure.aMediaList- Optional media list, used only for CSS resources.
-
WebSiteResourceWithCondition
protected WebSiteResourceWithCondition(@Nonnull WebSiteResource aResource, @Nullable String sConditionalComment, boolean bIsBundlable, @Nullable com.helger.css.media.ICSSMediaList aMediaList)
-
-
Method Details
-
getResource
- Returns:
- The resource as provided in the constructor. Never
null.
-
canBeBundledWith
Check if this resource can be bundled with the passed resource.- Parameters:
aOther- The resource to check against. May not benull.- Returns:
trueif this resource can be bundled with the passed resource,falseif not.
-
hasConditionalComment
public boolean hasConditionalComment()- Returns:
trueif a conditional comment is present,falseif not.
-
getConditionalComment
- Returns:
- The conditional comment to use or
nullif no such conditional comment is present.
-
isBundlable
public boolean isBundlable()Check if this resource can be bundled, independent of the conditional comment.- Returns:
trueif this resource can be bundled,falseif not.
-
getMediaList
-
getAsCSSPathProvider
-
getAsJSPathProvider
-
equals
-
hashCode
public int hashCode() -
toString
-
createForJS
@Nonnull public static WebSiteResourceWithCondition createForJS(@Nonnull com.helger.html.resource.js.IJSPathProvider aPP, boolean bRegular) Factory method for JavaScript resources.- Parameters:
aPP- The path provider.bRegular-truefor regular version,falsefor the minified/optimized version.- Returns:
- New
WebSiteResourceWithConditionobject. Nevernull.
-
createForJS
-
createForCSS
@Nonnull public static WebSiteResourceWithCondition createForCSS(@Nonnull com.helger.html.resource.css.ICSSPathProvider aPP, boolean bRegular) Factory method for CSS resources.- Parameters:
aPP- The path provider.bRegular-truefor regular version,falsefor the minified/optimized version.- Returns:
- New
WebSiteResourceWithConditionobject. Nevernull.
-
createForCSS
-