Class WAbstractDataInfo

java.lang.Object
eu.webtoolkit.jwt.WAbstractDataInfo
Direct Known Subclasses:
WDataInfo, WWebRootDataInfo

public class WAbstractDataInfo extends Object
An abstract base class storing information of a resource.

This is an abstract class which is meant to store/compute information about a resource/file. Its primary use is to map URIs to file paths. This is to avoid confusion when rendering out these resources, so that depending on the context the resources is created under, locating the file correctly happens.

  • Constructor Details

    • WAbstractDataInfo

      public WAbstractDataInfo()
  • Method Details

    • getFilePath

      public String getFilePath()
      Returns a path to a file containing the data.

      This returns a path to a file containing the data. This should point to a path that exists on the system.

      By default this will throw an exception.

      Warning: If you reimplement this function, you must also reimplement hasFilePath()

      See Also:
    • getUrl

      public String getUrl()
      Returns the URL of the data.

      This returns the URL of the data. This can be both an absolute URL or a URL relative to the application's base URL.

      By default this will throw an exception.

      Warning: If you reimplement this function, you must also reimplement hasUrl()

      See Also:
    • getDataUri

      public String getDataUri()
      Returns the data in data URI format.

      This returns the data in data URI format (see: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data).

      By default this will throw an exception.

      Warning: If you reimplement this function, you must also reimplement hasDataUri()

      See Also:
    • getName

      public String getName()
      Returns the name of the Data.

      This returns the name of the data. This is mainly use for error reporting.

      By default this will return getUrl() if hasUrl() is true. In case it is false, it will return getFilePath() if hasFilePath() is true, and it will return an empty string otherwise.

    • hasFilePath

      public boolean hasFilePath()
      Returns whether this contains a path to a file.

      This returns whether filePath returns a path to a file containing the data.

      By default this returns false.

      See Also:
    • hasUrl

      public boolean hasUrl()
      Returns whether this contains a URL.

      This returns whether getUrl() returns a URL of the data.

      By default this returns false.

      See Also:
    • hasDataUri

      public boolean hasDataUri()
      Returns whether this can return the data in data URI format.

      This returns whether getDataUri() returns the data in data URI format.

      By default this returns false.

      See Also: