Skip to content

Instantly share code, notes, and snippets.

@sebersole
Created December 5, 2019 13:32
Show Gist options
  • Save sebersole/32e8c18911112e837a211f93c03abbc0 to your computer and use it in GitHub Desktop.
Save sebersole/32e8c18911112e837a211f93c03abbc0 to your computer and use it in GitHub Desktop.
TableGroupImpl ... {
private final TableReference primaryRef;
private final BiFunction<TableReference,String,TableReferenceJoin> joinCreator;
private List<TableReferenceJoin> tableJoins;
...
@Override
public TableReference resolveTableReference(String tableExpression) {
if ( primaryRef... ) {
...
}
TableReferenceJoin existing = null;
if ( tableJoins == null ) {
tableJoins = new ...;
}
else {
for (TableReferenceJoin trj : tableJoins ) {
if ( ... ) {
existing = trj;
break;
}
}
}
if ( existing != null ) {
return existing;
}
final TableReferenceJoin trj = joinCreator.apply( primaryRef, tableExpression );
tableJoins.add( trj );
return trj;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment