Class TLcyCompositeModelReferenceParser
- All Implemented Interfaces:
ILcdModelReferenceParser,Iterable<ILcdModelReferenceParser>
Composite implementation (see composite design pattern) of ILcdModelReferenceParser.
It keeps a list of associated ILcdModelReferenceParsers.
When it is asked to parse a model reference, it loops over its associated ILcdModelReferenceParsers 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
ConstructorsConstructorDescriptionDefault constructor.TLcyCompositeModelReferenceParser(ILcyLucyEnv aLucyEnv) Construct aTLcyCompositeModelReferenceParserworking on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionparseModelReference(String aModelReferenceAsString) Returns theILcdModelReferencethat corresponds to the specified string representation.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, removeMethods 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
-
Constructor Details
-
TLcyCompositeModelReferenceParser
public TLcyCompositeModelReferenceParser()Default constructor.
The created instance will only work on the
ILcdModelReferenceParserinstances registered to it. If you want to use all registeredILcdModelReferenceParserinstances of the Lucy back-end, useTLcyCompositeModelReferenceParser(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyCompositeModelReferenceParser
Construct a
TLcyCompositeModelReferenceParserworking on the Lucy back-end.It will use all
ILcdModelReferenceParserinstances registered to the back-end, and adding and/or removingILcdModelReferenceParserto/from this composite will respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeModelReferenceParserwhich does not use the back-end, useTLcyCompositeModelReferenceParser()instead.- Parameters:
aLucyEnv- The Lucy back-end- See Also:
-
-
Method Details
-
parseModelReference
Description copied from interface:ILcdModelReferenceParserReturns theILcdModelReferencethat corresponds to the specified string representation.- Specified by:
parseModelReferencein interfaceILcdModelReferenceParser- Parameters:
aModelReferenceAsString- the String representation to be converted to anILcdModelReference.- Returns:
- the
ILcdModelReferencethat 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)
-