Class ResourceMapping


  • public final class ResourceMapping
    extends java.lang.Object
    Represents a mapping between identifiers and resources.
    See Also:
    Resource
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • colorResources

        private final java.util.Map<java.lang.String,​ColorResource> colorResources
      • fontResources

        private final java.util.Map<java.lang.String,​FontResource> fontResources
      • stringResources

        private final java.util.Map<java.lang.String,​StringResource> stringResources
      • fafResources

        private final java.util.Map<java.lang.String,​FAFileResource> fafResources
      • szaResources

        private final java.util.Map<java.lang.String,​SZAResource> szaResources
      • audioResources

        private final java.util.Map<java.lang.String,​AudioResource> audioResources
      • videoResources

        private final java.util.Map<java.lang.String,​VideoResource> videoResources
      • imageResources

        private final java.util.Map<java.lang.String,​ImageResource> imageResources
    • Constructor Detail

      • ResourceMapping

        public ResourceMapping()
        Creates a new empty ResourceMapping.
    • Method Detail

      • add

        public boolean add​(java.lang.String key,
                           Resource resource)
      • duplicateResource

        public boolean duplicateResource​(java.lang.String key,
                                         java.lang.String keyNew)
        Create another mapping for a Resource under a different key.
        Parameters:
        key - The key to find the existing Resource.
        keyNew - The new key for the duplicate.
        Returns:
        true on success
      • addAll

        public void addAll​(ResourceMapping rc)
        Adds all mappings from the given ResourceMapping to this object.
        Parameters:
        rc - The ResourceMapping.
      • getAudioResource

        public AudioResource getAudioResource​(java.lang.String key)
        Get an AudioResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The AudioResource found.
      • getColorResource

        public ColorResource getColorResource​(java.lang.String key)
        Get an ColorResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The ColorResource found.
      • getFAFileResource

        public FAFileResource getFAFileResource​(java.lang.String key)
        Get an FAFileResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The FAFileResource found.
      • getFontResource

        public FontResource getFontResource​(java.lang.String key)
        Get an FontResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The FontResource found.
      • getImageResource

        public ImageResource getImageResource​(java.lang.String key)
        Get an ImageResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The ImageResource found.
      • getStringResource

        public StringResource getStringResource​(java.lang.String key)
        Get an StringResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The StringResource found.
      • getSZAResource

        public SZAResource getSZAResource​(java.lang.String key)
        Get an SZAResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The SZAResource found.
      • getVideoResource

        public VideoResource getVideoResource​(java.lang.String key)
        Get an VideoResource by identifier.
        Parameters:
        key - The resource identifier.
        Returns:
        The VideoResource found.
      • getImageKeySet

        public java.util.Set<java.lang.String> getImageKeySet()
        Get the image keys in this mapping.
        Returns:
        A set of keys.
      • preload

        public int preload​(ResourceMapping.PreloadController preloadController)
        Preload all resources in this mapping.
        Parameters:
        preloadController - The PreloadController handling this preload.
        Returns:
        The number of resources loaded.
      • clearCaches

        public void clearCaches()