mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-01 16:19:49 +00:00
Replaced Tail Recursion while while/true loops. (#1019)
This commit is contained in:
committed by
Rob Bygrave
parent
8cef603d1c
commit
951e517caf
@@ -79,18 +79,22 @@ class DetermineAggPath {
|
||||
}
|
||||
|
||||
String getManyPath(int pos, DeployBeanDescriptor<?> desc) {
|
||||
while (true) {
|
||||
|
||||
String path = paths[pos];
|
||||
DeployBeanProperty details = desc.getBeanProperty(path);
|
||||
if (details instanceof DeployBeanPropertyAssocMany<?>) {
|
||||
return path(pos);
|
||||
String path = paths[pos];
|
||||
DeployBeanProperty details = desc.getBeanProperty(path);
|
||||
if (details instanceof DeployBeanPropertyAssocMany<?>) {
|
||||
return path(pos);
|
||||
|
||||
} else if (details instanceof DeployBeanPropertyAssocOne<?>) {
|
||||
DeployBeanPropertyAssocOne<?> one = (DeployBeanPropertyAssocOne<?>) details;
|
||||
DeployBeanDescriptor<?> targetDesc = one.getTargetDeploy();
|
||||
return getManyPath(pos + 1, targetDesc);
|
||||
} else if (details instanceof DeployBeanPropertyAssocOne<?>) {
|
||||
DeployBeanPropertyAssocOne<?> one = (DeployBeanPropertyAssocOne<?>) details;
|
||||
DeployBeanDescriptor<?> targetDesc = one.getTargetDeploy();
|
||||
desc = targetDesc;
|
||||
pos = pos + 1;
|
||||
continue;
|
||||
}
|
||||
throw new IllegalArgumentException("Can not find path to many in aggregation formula [" + aggregation + "]");
|
||||
}
|
||||
throw new IllegalArgumentException("Can not find path to many in aggregation formula [" + aggregation + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user