Class QueryableDatatypeSyncer.DBSafeInternalQDTAdaptor

  • Enclosing class:
    QueryableDatatypeSyncer

    public static class QueryableDatatypeSyncer.DBSafeInternalQDTAdaptor
    extends java.lang.Object
    One-shot cycle-aware recursive QDT adaptor. Converts from existing QDT to brand new one, and copies from one QDT to another.

    DBOperators can reference the same QDT that own the operator instance, such as: QueryableDatatype.setLiteralValue{this.operator = new DBEqualsOperator(this)}. Cycles are handled by tracking source QDTs observed and returning the previously mapped target QDT when re-observed.

    Must be used only once for a given read or write of a field.

    • Constructor Detail

      • DBSafeInternalQDTAdaptor

        public DBSafeInternalQDTAdaptor​(java.lang.Class<? extends QueryableDatatype<?>> targetQdtType,
                                        SafeOneWaySimpleTypeAdaptor typeAdaptor)
        Constructor
        Parameters:
        targetQdtType - targetQdtType
        typeAdaptor - typeAdaptor
    • Method Detail

      • convert

        public DBExpression convert​(DBExpression source)
        Creates a brand new QDT of the configured target type, based on converted values from the given QDT. Recursively traverses the operators and inner QDT references within the given QDT.

        If source is null, returns null.

        Parameters:
        source - the QDT to convert to the target type, may be null

        Support DBvolution at Patreon

        Returns:
        the newly created QDT of the target type, or null if source was null
      • setTargetQDTFromSourceQDT

        protected void setTargetQDTFromSourceQDT​(QueryableDatatype<?> targetQdt,
                                                 QueryableDatatype<?> sourceQdt)
        Updates the target QDT with converted values from the source QDT. Recursively traverses the operations and inner QDT references within the given source QTD.
        Parameters:
        targetQdt - the QDT to update (must not be null)
        sourceQdt - the QDT with values to convert and copy to the target (must not be null)