java.lang.Object
iu.type.ComponentResource<T>
- Type Parameters:
T
- resource type
- All Implemented Interfaces:
IuResource<T>
,Supplier<T>
Implementation of
IuResource
;-
Method Summary
Modifier and TypeMethodDescription(package private) static ComponentResource
<byte[]> createWebResource
(String name, byte[] data) Creates a static web resource.Supplier
<?> factory()
Gets the factory to be used for creating new instances.void
Provides a factory to use for creating new instances of the resource.get()
Gets the resource value.(package private) static Iterable
<ComponentResource<?>> getResources
(Class<?> targetClass) Gets all resources definitions tied to an implementation classname()
Gets the resource name.boolean
Determines whether or not the resource should be authenticated before handing off to a managed application.int
priority()
Indicates the initialization priority.boolean
shared()
Determines whether or not the resource is shared.toString()
type()
Gets the resource type
-
Method Details
-
createWebResource
Creates a static web resource.- Parameters:
name
- namedata
- content- Returns:
- static web resource
-
getResources
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 interfaceIuResource<T>
- Returns:
- true if the resource requires authentication; else false
-
priority
public int priority()Description copied from interface:IuResource
Indicates the initialization priority.- Specified by:
priority
in interfaceIuResource<T>
- Returns:
- initialization priority
-
name
Description copied from interface:IuResource
Gets the resource name.- Specified by:
name
in interfaceIuResource<T>
- Returns:
- resource name
-
type
Description copied from interface:IuResource
Gets the resource type- Specified by:
type
in interfaceIuResource<T>
- Returns:
- resource type
-
factory
Description copied from interface:IuResource
Gets the factory to be used for creating new instances.By default, returns a
Supplier
that:- Returns
IuType.autoboxDefault()
if theresource type
is an immutable single-value - Invokes
IuExecutable.exec(Object...)
on an an internally managed implementation class orInvocationHandler
suitable for representing the resource
- Specified by:
factory
in interfaceIuResource<T>
- Returns:
- factory that supplies new instance of the resource, or an
InvocationHandler
for backing aProxy
.
- Returns
-
factory
Description copied from interface:IuResource
Provides a factory to use for creating new instances of the resource.The factory may return:
- A direct instance of the
resource class
. - A instance of a class that implements the
resource interface
- An
InvocationHandler
to back aProxy
for theresource interface
To selective override default behavior, call
IuResource.factory()
first to get a reference to the default factory.- Specified by:
factory
in interfaceIuResource<T>
- Parameters:
factory
- resource implementation factory.
- A direct instance of the
-
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 whenIuResource.shared()
returns true. -
toString
-