Extract an interface from QBitComponentMetaDataProducer (which itself is still useful as a base class, so you don't have to implement get/setQBitConfig yourself), for implementations that already have a different base class.

This commit is contained in:
2025-05-30 20:25:53 -05:00
parent 395f94081f
commit 90cc5a32ac
3 changed files with 55 additions and 4 deletions

View File

@ -22,7 +22,6 @@
package com.kingsrook.qqq.backend.core.model.metadata.qbits;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerInterface;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerOutput;
@ -33,7 +32,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerOutput;
** Specifically exists to accept the QBitConfig as a type parameter and a value,
** easily accessed in the producer's methods as getQBitConfig()
*******************************************************************************/
public abstract class QBitComponentMetaDataProducer<T extends MetaDataProducerOutput, C extends QBitConfig> implements MetaDataProducerInterface<T>
public abstract class QBitComponentMetaDataProducer<T extends MetaDataProducerOutput, C extends QBitConfig> implements QBitComponentMetaDataProducerInterface<T, C>
{
private C qBitConfig = null;
@ -42,6 +41,7 @@ public abstract class QBitComponentMetaDataProducer<T extends MetaDataProducerOu
/*******************************************************************************
** Getter for qBitConfig
*******************************************************************************/
@Override
public C getQBitConfig()
{
return (this.qBitConfig);
@ -52,6 +52,7 @@ public abstract class QBitComponentMetaDataProducer<T extends MetaDataProducerOu
/*******************************************************************************
** Setter for qBitConfig
*******************************************************************************/
@Override
public void setQBitConfig(C qBitConfig)
{
this.qBitConfig = qBitConfig;

View File

@ -0,0 +1,50 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.backend.core.model.metadata.qbits;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerInterface;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerOutput;
/*******************************************************************************
** extension of MetaDataProducerInterface, designed for producing meta data
** within a (java-defined, at this time) QBit.
**
** Specifically exists to accept the QBitConfig as a type parameter and a value,
** easily accessed in the producer's methods as getQBitConfig()
*******************************************************************************/
public interface QBitComponentMetaDataProducerInterface<T extends MetaDataProducerOutput, C extends QBitConfig> extends MetaDataProducerInterface<T>
{
/*******************************************************************************
** Getter for qBitConfig
*******************************************************************************/
C getQBitConfig();
/*******************************************************************************
** Setter for qBitConfig
*******************************************************************************/
void setQBitConfig(C qBitConfig);
}

View File

@ -81,9 +81,9 @@ public interface QBitProducer
///////////////////////////////
for(MetaDataProducerInterface<?> producer : producers)
{
if(producer instanceof QBitComponentMetaDataProducer<?, ?>)
if(producer instanceof QBitComponentMetaDataProducerInterface<?,?>)
{
QBitComponentMetaDataProducer<?, C> qBitComponentMetaDataProducer = (QBitComponentMetaDataProducer<?, C>) producer;
QBitComponentMetaDataProducerInterface<?,C> qBitComponentMetaDataProducer = (QBitComponentMetaDataProducerInterface<?,C>) producer;
qBitComponentMetaDataProducer.setQBitConfig(qBitConfig);
}