mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 13:40:44 +00:00
Add method get(Class,String)
This commit is contained in:
@ -145,4 +145,36 @@ public class MetaDataProducerMultiOutput implements MetaDataProducerOutput, Sour
|
||||
setSourceQBitName(sourceQBitName);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* get a typed and named meta-data object out of this output container.
|
||||
*
|
||||
* @param <C> the type of the object to return, e.g., QTableMetaData
|
||||
* @param outputClass the class for the type to return
|
||||
* @param name the name of the object, e.g., a table or process name.
|
||||
* @return the requested TopLevelMetaDataInterface object (in the requested
|
||||
* type), or null if not found.
|
||||
***************************************************************************/
|
||||
public <C extends TopLevelMetaDataInterface> C get(Class<C> outputClass, String name)
|
||||
{
|
||||
for(MetaDataProducerOutput content : CollectionUtils.nonNullList(contents))
|
||||
{
|
||||
if(content instanceof MetaDataProducerMultiOutput multiOutput)
|
||||
{
|
||||
C c = multiOutput.get(outputClass, name);
|
||||
if(c != null)
|
||||
{
|
||||
return (c);
|
||||
}
|
||||
}
|
||||
else if(outputClass.isInstance(content) && name.equals(((TopLevelMetaDataInterface)content).getName()))
|
||||
{
|
||||
return (C) content;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user