Package iu.type

Class ComponentResource<T>

java.lang.Object
iu.type.ComponentResource<T>
Type Parameters:
T - resource type
All Implemented Interfaces:
IuResource<T>, Supplier<T>

class ComponentResource<T> extends Object implements IuResource<T>
Implementation of IuResource;
  • Method Details

    • createWebResource

      static ComponentResource<byte[]> createWebResource(String name, byte[] data)
      Creates a static web resource.
      Parameters:
      name - name
      data - content
      Returns:
      static web resource
    • getResources

      static Iterable<ComponentResource<?>> getResources(Class<?> targetClass)
      Gets all resources definitions tied to an implementation class
      Parameters:
      targetClass - class to check
      Returns:
      resource definitions
    • needsAuthentication

      public boolean needsAuthentication()
      Description copied from interface: IuResource
      Determines whether or not the resource should be authenticated before handing off to a managed application.
      Specified by:
      needsAuthentication in interface IuResource<T>
      Returns:
      true if the resource requires authentication; else false
    • shared

      public boolean shared()
      Description copied from interface: IuResource
      Determines whether or not the resource is shared.
      Specified by:
      shared in interface IuResource<T>
      Returns:
      true if the resource is shared; else false
    • priority

      public int priority()
      Description copied from interface: IuResource
      Indicates the initialization priority.
      Specified by:
      priority in interface IuResource<T>
      Returns:
      initialization priority
    • name

      public String name()
      Description copied from interface: IuResource
      Gets the resource name.
      Specified by:
      name in interface IuResource<T>
      Returns:
      resource name
    • type

      public IuType<?,T> type()
      Description copied from interface: IuResource
      Gets the resource type
      Specified by:
      type in interface IuResource<T>
      Returns:
      resource type
    • factory

      public Supplier<?> factory()
      Description copied from interface: IuResource
      Gets the factory to be used for creating new instances.

      By default, returns a Supplier that:

      Specified by:
      factory in interface IuResource<T>
      Returns:
      factory that supplies new instance of the resource, or an InvocationHandler for backing a Proxy.
    • factory

      public void factory(Supplier<?> factory)
      Description copied from interface: IuResource
      Provides a factory to use for creating new instances of the resource.

      The factory may return:

      To selective override default behavior, call IuResource.factory() first to get a reference to the default factory.

      Specified by:
      factory in interface IuResource<T>
      Parameters:
      factory - resource implementation factory.
    • get

      public T get()
      Description copied from interface: IuResource
      Gets the resource value.

      Provides a new or immutable instance when IuResource.shared() returns false; may provide the same instance on subsequent calls when IuResource.shared() returns true.

      Specified by:
      get in interface IuResource<T>
      Specified by:
      get in interface Supplier<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object