Class WebSiteResourceWithCondition

java.lang.Object
com.helger.photon.app.resource.WebSiteResourceWithCondition

@Immutable public class WebSiteResourceWithCondition extends Object
This encapsulates a WebSiteResource together with an optional conditional comment.
Author:
Philip Helger
  • 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 be null.
      sPath - Path to the resource. May neither be null nor empty.
      aCharset - Charset to read the file contents. May not be null.
      sConditionalComment - Optional conditional comment.
      bIsBundlable - true if this resource can be bundled. Use true if 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

      @Nonnull public WebSiteResource getResource()
      Returns:
      The resource as provided in the constructor. Never null.
    • canBeBundledWith

      public boolean canBeBundledWith(@Nonnull WebSiteResourceWithCondition aOther)
      Check if this resource can be bundled with the passed resource.
      Parameters:
      aOther - The resource to check against. May not be null.
      Returns:
      true if this resource can be bundled with the passed resource, false if not.
    • hasConditionalComment

      public boolean hasConditionalComment()
      Returns:
      true if a conditional comment is present, false if not.
    • getConditionalComment

      @Nullable public String getConditionalComment()
      Returns:
      The conditional comment to use or null if no such conditional comment is present.
    • isBundlable

      public boolean isBundlable()
      Check if this resource can be bundled, independent of the conditional comment.
      Returns:
      true if this resource can be bundled, false if not.
    • getMediaList

      @Nullable public com.helger.css.media.ICSSMediaList getMediaList()
    • getAsCSSPathProvider

      @Nonnull public com.helger.html.resource.css.ConstantCSSPathProvider getAsCSSPathProvider()
    • getAsJSPathProvider

      @Nonnull public com.helger.html.resource.js.ConstantJSPathProvider getAsJSPathProvider()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 - true for regular version, false for the minified/optimized version.
      Returns:
      New WebSiteResourceWithCondition object. Never null.
    • createForJS

      @Nonnull public static WebSiteResourceWithCondition createForJS(@Nonnull @Nonempty String sPath, @Nullable String sConditionalComment, boolean bIsBundlable)
    • 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 - true for regular version, false for the minified/optimized version.
      Returns:
      New WebSiteResourceWithCondition object. Never null.
    • createForCSS

      @Nonnull public static WebSiteResourceWithCondition createForCSS(@Nonnull @Nonempty String sPath, @Nullable String sConditionalComment, boolean bIsBundlable, @Nullable com.helger.css.media.ICSSMediaList aMediaList)