Class Resource

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Resource.Cleanable
      Implement the Cleanable interface if a Resource has a use for calls to a clean method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String primaryKey
      The primary key for the resource to be used for caching purposes.
      private java.net.URI resourceLocator
      The URI used when loading this resource.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Resource​(java.lang.String primaryKey)
      Trivial constructor.
      protected Resource​(java.lang.String primaryKey, java.net.URI resourceLocator)
      Do not use directly.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPrimaryKey()
      The primary key of the resource.
      java.net.URI getResourceLocator()
      Returns the URI used for loading the resource.
      abstract void preload()
      Preload the resource if possible/meaningful.
      • Methods inherited from class java.lang.Object

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

      • resourceLocator

        private final java.net.URI resourceLocator
        The URI used when loading this resource.
      • primaryKey

        private final java.lang.String primaryKey
        The primary key for the resource to be used for caching purposes.
    • Constructor Detail

      • Resource

        protected Resource​(java.lang.String primaryKey)
        Trivial constructor.
        Parameters:
        primaryKey - The primary key.
      • Resource

        protected Resource​(java.lang.String primaryKey,
                           java.net.URI resourceLocator)
        Do not use directly.
        Parameters:
        primaryKey - The key for the primary version of the resource, that is the key when the Resource was created.
        resourceLocator - The URI used when loading this resource.
    • Method Detail

      • getPrimaryKey

        public java.lang.String getPrimaryKey()
        The primary key of the resource. This key can be used for caching purposes since it will be the same for a resource no matter how many keys point to the same resource. Beware: All variations and sizes share the same primary key.
        Returns:
        The key.
      • getResourceLocator

        public java.net.URI getResourceLocator()
        Returns the URI used for loading the resource.
        Returns:
        The URI.
      • preload

        public abstract void preload()
        Preload the resource if possible/meaningful.