Class WAbstractDataInfo

  • Direct Known Subclasses:
    WDataInfo, WWebRootDataInfo

    public class WAbstractDataInfo
    extends java.lang.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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDataUri()
      Returns the data in data URI format.
      java.lang.String getFilePath()
      Returns a path to a file containing the data.
      java.lang.String getName()
      Returns the name of the Data.
      java.lang.String getUrl()
      Returns the URL of the data.
      boolean hasDataUri()
      Returns whether this can return the data in data URI format.
      boolean hasFilePath()
      Returns whether this contains a path to a file.
      boolean hasUrl()
      Returns whether this contains a URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WAbstractDataInfo

        public WAbstractDataInfo()
    • Method Detail

      • getFilePath

        public java.lang.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:
        hasFilePath()
      • getUrl

        public java.lang.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:
        hasUrl()
      • getName

        public java.lang.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:
        getFilePath()
      • 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:
        getUrl()
      • 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:
        getDataUri()