Interface IResourceLookup

  • All Known Subinterfaces:
    IResourceManager

    public interface IResourceLookup
    Access to the resource management system. Implemented by IResourceManager.
    Author:
    hb
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> list()
      return an iterator of bound names (active resources) that is usually less than what can be served.
      <T> T lookup​(java.lang.String resourceId, TypeRef<T> typeRef)
      Type safe lookup for resource identified by a name.
      <T> T lookup​(java.lang.String resourceId, java.lang.Class<T> clz)
      Type safe lookup for resource identified by a name.
      <T> T query​(java.lang.String resourceId, TypeRef<T> typeRef)
      Type safe lookup for resource identified by a name.
      <T> T query​(java.lang.String resourceId, java.lang.Class<T> clz)
      Type safe lookup for resource identified by a name.
    • Method Detail

      • lookup

        <T> T lookup​(java.lang.String resourceId,
                     java.lang.Class<T> clz)
        Type safe lookup for resource identified by a name. If the named resource is not loaded into memory as of the moment of this call, a corresponding provider will be looked up and asked to provide the resource. Note that nesting is only two levels deep. On the outer level of the resource manager, names are of the form <name space>/<name> while name space local lookups use their own naming scheme for which all characters but question marks are allowed.
        Parameters:
        resourceId - a resource name name.
        clz - expected resource type.
        Returns:
        resource instance of null if the resource is not available
      • query

        <T> T query​(java.lang.String resourceId,
                    java.lang.Class<T> clz)
        Type safe lookup for resource identified by a name. This method will only return non-null if the resource in question has been loaded into memory. Note that nesting is only two levels deep. On the outer level of the resource manager, names are of the form <name space>/<name> while name space local lookups use their own naming scheme.
        Parameters:
        resourceId - a resource name name
        clz - expected resource type.
        Returns:
        resource instance of null if the resource is not available
      • lookup

        <T> T lookup​(java.lang.String resourceId,
                     TypeRef<T> typeRef)
        Type safe lookup for resource identified by a name. If the named resource is not loaded into memory as of the moment of this call, a corresponding provider will be looked up and asked to provide the resource. Note that nesting is only two levels deep. On the outer level of the resource manager, names are of the form <name space>/<name> while name space local lookups use their own naming scheme for which all characters but question marks are allowed. Using the TypeRef API, it is possible to specify parameterized types in a type-safe manner. For example:
         
         lookup(new TypeRef<List<String>>(){});
         
         
        Parameters:
        resourceId - a resource name name.
        typeRef - expected resource type as TypeRef supporting parameterized types.
        Returns:
        resource instance of null if the resource is not available
      • query

        <T> T query​(java.lang.String resourceId,
                    TypeRef<T> typeRef)
        Type safe lookup for resource identified by a name. This method will only return non-null if the resource in question has been loaded into memory. Note that nesting is only two levels deep. On the outer level of the resource manager, names are of the form <name space>/<name> while name space local lookups use their own naming scheme. Using the TypeRef API, it is possible to specify parameterized types in a type-safe manner. For example:
         
         lookup(new TypeRef<List<String>>(){});
         
         
        Parameters:
        resourceId - a resource name name
        typeRef - expected resource type as TypeRef supporting parameterized types.
        Returns:
        resource instance of null if the resource is not available
      • list

        java.util.List<java.lang.String> list()
        return an iterator of bound names (active resources) that is usually less than what can be served.