use of org.jooq.QueryPartInternal in project jOOQ by jOOQ.
the class AbstractContext method visit.
// ------------------------------------------------------------------------
// VisitListener API
// ------------------------------------------------------------------------
@Override
public final C visit(QueryPart part) {
if (part != null) {
// Issue start clause events
// -----------------------------------------------------------------
Clause[] clauses = Tools.isNotEmpty(visitListenersStart) ? clause(part) : null;
if (clauses != null)
for (int i = 0; i < clauses.length; i++) start(clauses[i]);
// Perform the actual visiting, or recurse into the replacement
// -----------------------------------------------------------------
QueryPart replacement = start(part);
if (replacement != null) {
QueryPartInternal internal = (QueryPartInternal) scopeMapping(replacement);
// We're declaring fields, but "part" does not declare fields
if (declareFields() && !internal.declaresFields()) {
boolean aliases = declareAliases();
declareFields(false);
visit0(internal);
declareFields(true);
declareAliases(aliases);
} else // We're declaring tables, but "part" does not declare tables
if (declareTables() && !internal.declaresTables()) {
boolean aliases = declareAliases();
declareTables(false);
visit0(internal);
declareTables(true);
declareAliases(aliases);
} else // We're declaring windows, but "part" does not declare windows
if (declareWindows() && !internal.declaresWindows()) {
declareWindows(false);
visit0(internal);
declareWindows(true);
} else // We're declaring cte, but "part" does not declare cte
if (declareCTE() && !internal.declaresCTE()) {
declareCTE(false);
visit0(internal);
declareCTE(true);
} else if (!castModeOverride && castMode() != CastMode.DEFAULT && !internal.generatesCast()) {
CastMode previous = castMode();
castMode(CastMode.DEFAULT);
visit0(internal);
castMode(previous);
} else // We're not declaring, or "part" can declare
{
visit0(internal);
}
}
end(replacement);
// -----------------------------------------------------------------
if (clauses != null)
for (int i = clauses.length - 1; i >= 0; i--) end(clauses[i]);
}
return (C) this;
}
Aggregations