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
FieldsModifier and TypeFieldDescriptionstatic final intConstant defining the normal priority.static final intConstant defining the fallback priority. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TLcyGenericComposite(ILcyLucyEnv aLucyEnv, Class<T> aServiceClass) Construct aTLcyGenericCompositeworking on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given instance ofTto the list of registered instances.voidAdds the given instance ofTto the list of registered instances with the given priority.getList()Returns an unmodifiableListcontaining all registered instances ofT.intgetPriority(int aIndex) Returns the priority for the service at the specified indexiterator()voidRemoves the given instance ofTto the list of registered instances.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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_FALLBACKconstant. 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_NORMALconstant. 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
Tregistered to it. If you want to use all registered instances ofTof the Lucy back-end, useTLcyGenericComposite(com.luciad.lucy.ILcyLucyEnv, Class)instead.- See Also:
-
TLcyGenericComposite
Construct a
TLcyGenericCompositeworking on the Lucy back-end.It will use all instances of
Tregistered to the back-end, and adding an/or removing instances ofTto/from thisTLcyGenericCompositewill respectively add/remove it as service from the back-end.If you want to create a
TLcyGenericCompositewhich 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 implementingTand another interface, it will only be registered as a service of classTand not for the other interface.
-
-
Method Details
-
add
Adds the given instance of
Tto 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
Tto 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
ILcyLucyEnvis used, the instance ofTwill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object)). When callingILcyLucyEnv.getServices(Class)afterwards,aServicewill 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 ofTafterwards, 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_DEFAULTandPRIORITY_FALLBACK
-
remove
Removes the given instance of
Tto the list of registered instances. Nothing will happen if the given instance was never added before.If the constructor specifying an
ILcyLucyEnvis used, the instance ofTwill be removed as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object)). Note: it is only possible to remove instances ofTwhich were registered using theadd(Object)method.- Parameters:
aService- The instance to add.- See Also:
-
iterator
-
getList
Returns an unmodifiable
Listcontaining all registered instances ofT.- Returns:
- an unmodifiable
Listcontaining 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
-