Add method get(Class,String)

This commit is contained in:
2025-07-03 08:04:07 -05:00
parent f97a3d5097
commit 946e7d418b
2 changed files with 116 additions and 0 deletions

View File

@ -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;
}
}