Class TLcyCompositeModelReferenceParser
- All Implemented Interfaces:
ILcdModelReferenceParser
,Iterable<ILcdModelReferenceParser>
Composite implementation (see composite design pattern) of ILcdModelReferenceParser
.
It keeps a list of associated ILcdModelReferenceParser
s.
When it is asked to parse a model reference, it loops over its associated ILcdModelReferenceParser
s to find one that can parse the input.
The model reference provided by that decoder is returned.
When creating a new TLcyCompositeModelReferenceParser
using the default constructor,
the created instance will only work on/with the registered instances on this composite instance.
When creating a new TLcyCompositeModelReferenceParser
using the constructor specifying an ILcyLucyEnv
instance,
the created composite will work on the Lucy back-end services.
It will use all registered ILcdModelReferenceParser
instances of the Lucy back-end,
adding and/or removing an ILcdModelReferenceParser
will add/remove the parser as service from Lucy, ... .
Parsing an ILcdModelReference
from its string representation 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
TLcyCompositeModelReferenceParser parser = new TLcyCompositeModelReferenceParser( aLucyEnv );
try{
ILcdModelReference modelReference = parser.parseModelReference( aModelReferenceAsString );
} catch ( ParseException aException ){
//exception occurred during the parsing
}
//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;
- Since:
- 11.2.x
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK
-
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyCompositeModelReferenceParser
(ILcyLucyEnv aLucyEnv) Construct aTLcyCompositeModelReferenceParser
working on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionparseModelReference
(String aModelReferenceAsString) Returns theILcdModelReference
that corresponds to the specified string representation.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, remove
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
-
Constructor Details
-
TLcyCompositeModelReferenceParser
public TLcyCompositeModelReferenceParser()Default constructor.
The created instance will only work on the
ILcdModelReferenceParser
instances registered to it. If you want to use all registeredILcdModelReferenceParser
instances of the Lucy back-end, useTLcyCompositeModelReferenceParser(com.luciad.lucy.ILcyLucyEnv)
instead.- See Also:
-
TLcyCompositeModelReferenceParser
Construct a
TLcyCompositeModelReferenceParser
working on the Lucy back-end.It will use all
ILcdModelReferenceParser
instances registered to the back-end, and adding and/or removingILcdModelReferenceParser
to/from this composite will respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeModelReferenceParser
which does not use the back-end, useTLcyCompositeModelReferenceParser()
instead.- Parameters:
aLucyEnv
- The Lucy back-end- See Also:
-
-
Method Details
-
parseModelReference
Description copied from interface:ILcdModelReferenceParser
Returns theILcdModelReference
that corresponds to the specified string representation.- Specified by:
parseModelReference
in interfaceILcdModelReferenceParser
- Parameters:
aModelReferenceAsString
- the String representation to be converted to anILcdModelReference
.- Returns:
- the
ILcdModelReference
that corresponds to the specified string, nevernull
. - Throws:
ParseException
- if this parser cannot convert the specified string into a model reference (e.g. if the code is not supported or if the code was not valid)
-