java.lang.Object
iu.type.ComponentResourceReference<R,T>
- Type Parameters:
R
- referrer typeT
- resource type
- All Implemented Interfaces:
InstanceReference<R>
,IuResourceReference<R,
,T> Consumer<R>
class ComponentResourceReference<R,T>
extends Object
implements IuResourceReference<R,T>, InstanceReference<R>
Implementation of
IuResource
;-
Constructor Summary
ConstructorsConstructorDescriptionComponentResourceReference
(DeclaredAttribute<R, ? super T> attribute, Resource resource) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts a referrer instance as abinding target
.void
bind
(IuResource<T> resource) Binds aresource
to all referrer instances.void
Clears all references to an instance.boolean
isBound()
Determines whether or not the reference has been bound.name()
Gets the resource name.Gets the referrer type.toString()
TypeTemplate
<?, T> type()
Gets the resource typeGets the default value to use when the resource reference could not be bound to an environment entry or container resource.
-
Constructor Details
-
ComponentResourceReference
ComponentResourceReference(DeclaredAttribute<R, ? super T> attribute, Resource resource) Constructor.- Parameters:
attribute
- facade for the attribute backing the resourceresource
- resource annotation associated with the attribute
-
-
Method Details
-
name
Description copied from interface:IuResourceReference
Gets the resource name.- Specified by:
name
in interfaceIuResourceReference<R,
T> - Returns:
- resource name
-
type
Description copied from interface:IuResourceReference
Gets the resource type- Specified by:
type
in interfaceIuResourceReference<R,
T> - Returns:
- resource type
-
referrerType
Description copied from interface:IuResourceReference
Gets the referrer type.- Specified by:
referrerType
in interfaceIuResourceReference<R,
T> - Returns:
- referrer type
-
isBound
public boolean isBound()Description copied from interface:IuResourceReference
Determines whether or not the reference has been bound.- Specified by:
isBound
in interfaceIuResourceReference<R,
T> - Returns:
- true if
bound
with a non-null resource; else false
-
bind
Description copied from interface:IuResourceReference
Binds aresource
to all referrer instances.A reference to the bound resource will be provided to all referrer instances
accepted
prior to binding. Once bound, new referrer instances will be provided a reference to theresource
whenaccepted
.- Specified by:
bind
in interfaceIuResourceReference<R,
T> - Parameters:
resource
-IuResource
to bind to the reference; may be null to unbind the reference
-
accept
Description copied from interface:IuResourceReference
Accepts a referrer instance as abinding target
. -
value
Description copied from interface:IuResourceReference
Gets the default value to use when the resource reference could not be bound to an environment entry or container resource.- Specified by:
value
in interfaceIuResourceReference<R,
T> - Parameters:
referrer
- referrer instance- Returns:
- default value; null if no default is defined for the reference
-
clear
Description copied from interface:InstanceReference
Clears all references to an instance.Reverses
Consumer.accept(Object)
.- Specified by:
clear
in interfaceInstanceReference<R>
- Parameters:
referrer
- instance
-
toString
-