From does have method getJoins and TupleElement method getAlias. Root implements them, so following should work:
//TODO: apply generics; argument do not have to be root, but
// something that implements From and TupleElement
private Join findJoin(Root root, String alias) {
Set<Join> joins= root.getJoins();
for (Join join: joins) {
if (alias.equals(join.getAlias())) {
return join;
}
}
throw new IllegalArgumentException("No join for alias:" + alias);
}