public class TLcyCompositeModelContentTypeProvider extends TLcyGenericComposite<ILcyModelContentTypeProvider> implements ILcyModelContentTypeProvider
A composite implementation of ILcyModelContentTypeProvider
according to the
composite design pattern.
When creating a new TLcyCompositeModelContentTypeProvider
using the default
constructor (see TLcyCompositeModelContentTypeProvider()
), the created instance will
only work on/with the ILcyModelContentTypeProviders registered
on this composite instance (see addModelContentTypeProvider(ILcyModelContentTypeProvider)
and removeModelContentTypeProvider(ILcyModelContentTypeProvider)
).
When creating a new TLcyCompositeModelContentTypeProvider
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeModelContentTypeProvider(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ILcyModelContentTypeProvider instances of the
Lucy back-end, adding and/or removing an ILcyModelContentTypeProvider
will
add/remove the ILcyModelContentTypeProvider
as service from Lucy, ... .
Retrieving the model content type for an ILcdModel
using the back-end based implementation
can be done by creating a new instance of this class:
//Create a new instance whenever you need it.
TLcyCompositeModelContentTypeProvider provider = new TLcyCompositeModelContentTypeProvider( aLucyEnv );
int modelContentType = provider.getModelContentType( aModel );
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
provider = null;
PRIORITY_DEFAULT, PRIORITY_FALLBACK
Constructor and Description |
---|
TLcyCompositeModelContentTypeProvider()
Default constructor.
|
TLcyCompositeModelContentTypeProvider(ILcyLucyEnv aLucyEnv)
Construct a
TLcyCompositeModelContentTypeProvider working on the Lucy
back-end |
Modifier and Type | Method and Description |
---|---|
void |
addModelContentTypeProvider(ILcyModelContentTypeProvider aModelContentTypeProvider)
Adds the given model content type provider to the list of registered content type
providers.
|
int |
getModelContentType(ILcdModel aModel)
Implementation of ILcyModelContentTypeProvider.getModelContentType.
|
ILcyModelContentTypeProvider |
getModelContentTypeProvider(int aIndex)
Returns the model content type provider at the given index.
|
int |
getModelContentTypeProviderCount()
Returns the number of currently registered content type providers.
|
void |
removeModelContentTypeProvider(ILcyModelContentTypeProvider aModelContentTypeProvider)
Removes the given model content type provider from the list of registered content type
providers.
|
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TLcyCompositeModelContentTypeProvider()
Default constructor.
The created instance will only work on the ILcyModelContentTypeProvider
instances registered to it. If you want to use all registered ILcyModelContentTypeProvider
instances of the Lucy back-end, use TLcyCompositeModelContentTypeProvider(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyCompositeModelContentTypeProvider(ILcyLucyEnv aLucyEnv)
Construct a TLcyCompositeModelContentTypeProvider
working on the Lucy
back-end
It will use all ILcyModelContentTypeProvider
instances registered to the
back-end, and adding and/or removing ILcyModelContentTypeProvider
s to/from this
TLcyCompositeModelContentProvider
will respectively add/remove it as service from
the back-end.
If you want to create a TLcyCompositeModelContentTypeProvider
which does not
use the back-end, use TLcyCompositeModelContentTypeProvider()
instead.
aLucyEnv
- The Lucy back-end.TLcyCompositeModelContentTypeProvider()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public void addModelContentTypeProvider(ILcyModelContentTypeProvider aModelContentTypeProvider)
Adds the given model content type provider to the list of registered content type providers.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyModelContentTypeProvider
will be registered as a service on the Lucy back-end
(see ILcyLucyEnv.addService(Object, int)
). When calling ILcyLucyEnv.getServices(Class)
afterwards, aModelContentTypeProvider
will only be included in the returned list when the requested class was
ILcyModelContentTypeProvider.class
.
Note: if you want to remove the registered ILcyModelContentTypeProvider
afterwards, use removeModelContentTypeProvider(ILcyModelContentTypeProvider)
and not
ILcyLucyEnv.removeService(Object)
.
aModelContentTypeProvider
- The model content type provider to add.removeModelContentTypeProvider(com.luciad.lucy.model.ILcyModelContentTypeProvider)
public void removeModelContentTypeProvider(ILcyModelContentTypeProvider aModelContentTypeProvider)
Removes the given model content type provider from the list of registered content type providers. Nothing will happen if the given provider was never added before.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyModelContentTypeProvider
will be removed as service from the Lucy back-end
(see ILcyLucyEnv.removeService(Object)
).
Note: it is only possible to remove ILcyModelContentTypeProvider
instances
which were registered using the addModelContentTypeProvider(ILcyModelContentTypeProvider)
method.
aModelContentTypeProvider
- The content type provider to remove.addModelContentTypeProvider(com.luciad.lucy.model.ILcyModelContentTypeProvider)
public int getModelContentTypeProviderCount()
Returns the number of currently registered content type providers.
getModelContentTypeProvider(int)
public ILcyModelContentTypeProvider getModelContentTypeProvider(int aIndex)
aIndex
- The index to retrieve the model content provider for. Note that 0 <= aIndex < getModelContentTypeProviderCount()
getModelContentTypeProviderCount()
public int getModelContentType(ILcdModel aModel)
ILcyModelContentTypeProvider
s and tries to find a suitable
ILcyModelContentTypeProvider
. Suitable means that the provider does not return
ILcyModelContentType.UNKNOWN. The content type value of the first suitable
ILcyModelContentTypeProvider
is returned, or ILcyModelContentType.UNKNOWN if no
suitable ILcyModelContentTypeProvider
could be found.getModelContentType
in interface ILcyModelContentTypeProvider
aModel
- The model to retrieve the content type of.ILcyModelContentTypeProvider
could be found.ILcyModelContentType