Package nz.co.gregs.dbvolution.datatypes
Class QueryableDatatypeSyncer.DBSafeInternalQDTAdaptor
- java.lang.Object
-
- nz.co.gregs.dbvolution.datatypes.QueryableDatatypeSyncer.DBSafeInternalQDTAdaptor
-
- Enclosing class:
- QueryableDatatypeSyncer
public static class QueryableDatatypeSyncer.DBSafeInternalQDTAdaptor extends java.lang.ObjectOne-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 Summary
Constructors Constructor Description DBSafeInternalQDTAdaptor(java.lang.Class<? extends QueryableDatatype<?>> targetQdtType, SafeOneWaySimpleTypeAdaptor typeAdaptor)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DBExpressionconvert(DBExpression source)Creates a brand new QDT of the configured target type, based on converted values from the given QDT.protected voidsetTargetQDTFromSourceQDT(QueryableDatatype<?> targetQdt, QueryableDatatype<?> sourceQdt)Updates the target QDT with converted values from the source QDT.
-
-
-
Constructor Detail
-
DBSafeInternalQDTAdaptor
public DBSafeInternalQDTAdaptor(java.lang.Class<? extends QueryableDatatype<?>> targetQdtType, SafeOneWaySimpleTypeAdaptor typeAdaptor)
Constructor- Parameters:
targetQdtType- targetQdtTypetypeAdaptor- 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
sourceis null, returnsnull.- Parameters:
source- the QDT to convert to the target type, may be nullSupport DBvolution at Patreon
- Returns:
- the newly created QDT of the target type, or null if
sourcewas 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)
-
-