Class TLcyGenericComposite<T>
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
TLcyCompositeAsynchronousPaintHintProvider
,TLcyCompositeBalloonContentProvider
,TLcyCompositeCameraLinkerFactory
,TLcyCompositeCustomizerPanelFactory
,TLcyCompositeGXYLayerDecoder
,TLcyCompositeGXYLayerEncoder
,TLcyCompositeGXYLayerFactory
,TLcyCompositeGXYLayerTypeProvider
,TLcyCompositeHyperlinkListener
,TLcyCompositeInputStreamFactory
,TLcyCompositeLayerHeightProviderFactory
,TLcyCompositeLayerMeasureProviderFactory
,TLcyCompositeLayerStyleCodec
,TLcyCompositeLayerStyleProvider
,TLcyCompositeModelContentTypeProvider
,TLcyCompositeModelDecoder
,TLcyCompositeModelEncoder
,TLcyCompositeModelFactory
,TLcyCompositeModelHeightProviderFactory
,TLcyCompositeModelMeasureProviderFactory
,TLcyCompositeModelReferenceDecoder
,TLcyCompositeModelReferenceParser
,TLcyCompositeOutputStreamFactory
,TLcyCompositeOWSTransport
,TLcyCompositeSimulatorModelFactory
,TLcyGXYCompositeLabelPlacementHintProvider
,TLcyLspCompositeLayerFactory
A composite implementation of T
according to the composite design pattern.
When creating a TLcyGenericComposite<T>
using the default constructor (see
TLcyGenericComposite()
, the created instance will only work on/with the instances of
T
registered on this composite instance (see add(Object)
and remove(Object)
).
When creating a new TLcyGenericComposite<T>
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyGenericComposite(com.luciad.lucy.ILcyLucyEnv, Class)
, the created instance will work on the
Lucy back-end services. It will
use all registered instances of T
of the Lucy back-end, adding and/or removing an
instance of T
will add/remove the instance as service from Lucy, ... .
- Since:
- 10.1
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant defining the normal priority.static final int
Constant defining the fallback priority. -
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyGenericComposite
(ILcyLucyEnv aLucyEnv, Class<T> aServiceClass) Construct aTLcyGenericComposite
working on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given instance ofT
to the list of registered instances.void
Adds the given instance ofT
to the list of registered instances with the given priority.getList()
Returns an unmodifiableList
containing all registered instances ofT
.int
getPriority
(int aIndex) Returns the priority for the service at the specified indexiterator()
void
Removes the given instance ofT
to the list of registered instances.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
PRIORITY_DEFAULT
public static final int PRIORITY_DEFAULTConstant defining the normal priority. Services added with this priority constant have a higher priority than services added with the
PRIORITY_FALLBACK
constant. Its value is the same asILcyLucyEnv.PRIORITY_DEFAULT
.- See Also:
-
PRIORITY_FALLBACK
public static final int PRIORITY_FALLBACKConstant defining the fallback priority. Services added with this priority constant have a lower priority than services added with the
PRIORITY_NORMAL
constant. Its value is the same asILcyLucyEnv.PRIORITY_FALLBACK
.- See Also:
-
-
Constructor Details
-
TLcyGenericComposite
public TLcyGenericComposite()Default constructor.
The created instance will only work on the instances of
T
registered to it. If you want to use all registered instances ofT
of the Lucy back-end, useTLcyGenericComposite(com.luciad.lucy.ILcyLucyEnv, Class)
instead.- See Also:
-
TLcyGenericComposite
Construct a
TLcyGenericComposite
working on the Lucy back-end.It will use all instances of
T
registered to the back-end, and adding an/or removing instances ofT
to/from thisTLcyGenericComposite
will respectively add/remove it as service from the back-end.If you want to create a
TLcyGenericComposite
which does not use the back-end, useTLcyGenericComposite()
instead.- Parameters:
aLucyEnv
- The Lucy back-end. Whennull
, calling this constructor is equivalent to calling the default constructorTLcyGenericComposite()
.aServiceClass
- The class of the service that this composite will manage. E.g. if you add an object implementingT
and another interface, it will only be registered as a service of classT
and not for the other interface.
-
-
Method Details
-
add
Adds the given instance of
T
to the list of registered instances.Equivalent of calling
add(Object, int)
withPRIORITY_DEFAULT
- Parameters:
aService
- The instance to add.- See Also:
-
add
Adds the given instance of
T
to the list of registered instances with the given priority. A single instance can only have one priority at a time, so it cannot be added twice with two different priorities.If the constructor specifying an
ILcyLucyEnv
is used, the instance ofT
will be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object)
). When callingILcyLucyEnv.getServices(Class)
afterwards,aService
will only be included in the returned list when the requested class was the class specified in the constructor. Note: if you want to remove the registered instance ofT
afterwards, useremove(Object)
and notILcyLucyEnv.removeService(Object)
.- Parameters:
aService
- The instance to add.aPriority
- The priority for the instance. Lower values mean higher priorities. Services with higher priority appear earlier in the list of results. Common values arePRIORITY_DEFAULT
andPRIORITY_FALLBACK
-
remove
Removes the given instance of
T
to the list of registered instances. Nothing will happen if the given instance was never added before.If the constructor specifying an
ILcyLucyEnv
is used, the instance ofT
will be removed as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object)
). Note: it is only possible to remove instances ofT
which were registered using theadd(Object)
method.- Parameters:
aService
- The instance to add.- See Also:
-
iterator
-
getList
Returns an unmodifiable
List
containing all registered instances ofT
.- Returns:
- an unmodifiable
List
containing all registered instances ofT
.
-
getPriority
public int getPriority(int aIndex) Returns the priority for the service at the specified index- Parameters:
aIndex
- The index of the service for which the priority should be returned.- Returns:
- The priority for the service at the specified index
-