Class MetaDataProducerHelper

java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerHelper

public class MetaDataProducerHelper extends Object
Help work with MetaDataProducers.

Note that all of the public methods here use sortMetaDataProducers, which by default will sort by the sortOrder specified in the producer objects, then by the type that they return, and finally by their class simple name, then full name.

But - this sorting by class names was added in 0.40.0. Prior to that, there was no tie breaker on the sort. To restore the previous behavior, set the system property qqq.MetaDataProducerHelper.disableNameTiebreaker to true.

  • Constructor Details

    • MetaDataProducerHelper

      public MetaDataProducerHelper()
  • Method Details

    • processAllMetaDataProducersInPackage

      public static void processAllMetaDataProducersInPackage(QInstance instance, String packageName, MetaDataCustomizerInterface<QTableMetaData> tableMetaDataCustomizer) throws QException
      Recursively find all classes in the given package, that implement MetaDataProducerInterface run them, and add their output to the given qInstance - using the provided tableMetaDataCustomizer to help with all RecordEntity's that are configured to make tables. Note - they'll be sorted by the sortOrder they provide.
      Throws:
      QException
    • findProducers

      public static List<MetaDataProducerInterface<?>> findProducers(String packageName) throws QException
      Throws:
      QException
    • sortMetaDataProducers

      public static void sortMetaDataProducers(List<MetaDataProducerInterface<?>> producers)
      sort a list of producers: First by the sortOrder specified in the producer objects. Second based on their types, so kinds that depend on other kinds come later. Third, by class simple name, and 4th by full class name, to give stable ordering (unless opt'ed out by system property).

      Note, we use simple name before full name, in case, for some reason, you wanted to control the sort by naming your classes a certain way - easier to change Simple names than packages.

    • processAllMetaDataProducersInPackage

      public static void processAllMetaDataProducersInPackage(QInstance instance, String packageName) throws QException
      Recursively find all classes in the given package, that implement MetaDataProducerInterface run them, and add their output to the given qInstance. Note - they'll be sorted by the sortOrder they provide.
      Throws:
      QException
    • getTableMetaDataCustomizer

      public MetaDataCustomizerInterface<QTableMetaData> getTableMetaDataCustomizer()
      Getter for tableMetaDataCustomizer
    • setTableMetaDataCustomizer

      public void setTableMetaDataCustomizer(MetaDataCustomizerInterface<QTableMetaData> tableMetaDataCustomizer)
      Setter for tableMetaDataCustomizer
    • withTableMetaDataCustomizer

      public void withTableMetaDataCustomizer(MetaDataCustomizerInterface<QTableMetaData> tableMetaDataCustomizer)
      Fluent setter for tableMetaDataCustomizer