File |
Line |
at\rseiler\spbee\core\generator\DtoGenerator.java |
342 |
at\rseiler\spbee\core\generator\DtoGenerator.java |
362 |
JClass varType = CodeModelUtil.getGenericList(model, variable.getTypeInfo().getGenericType().get());
JVar list = method.body().decl(varType, "list" + i);
method.body().assign(list, JExpr.cast(varType, map.invoke("get").arg("#result-set-" + i)));
JVar obj = method.body().decl(model.directClass(variable.getTypeInfo().getType()), "obj" + i);
JConditional condition = method.body()._if(list.invoke("size").eq(JExpr.lit(1)));
condition._then().assign(obj, model.directClass(Optional.class.getCanonicalName()).staticInvoke("of").arg(list.invoke("get").arg(JExpr.lit(0)))); |
File |
Line |
at\rseiler\spbee\core\generator\DtoGenerator.java |
372 |
at\rseiler\spbee\core\generator\DtoGenerator.java |
483 |
condition._then().assign(obj, JExpr._null());
condition._else()._throw(JExpr._new(model.directClass(MultipleObjectsReturned.class.getCanonicalName())));
} else {
condition = condition._elseif(list.invoke("size").eq(JExpr.lit(0)));
condition._then()._throw(JExpr._new(model.directClass(ObjectDoesNotExist.class.getCanonicalName())));
condition._else()._throw(JExpr._new(model.directClass(MultipleObjectsReturned.class.getCanonicalName())));
} |