Skip to content

Commit

Permalink
small fixes to @find and @hql methods
Browse files Browse the repository at this point in the history
don't include session parameter type where not necessary
  • Loading branch information
gavinking committed Feb 3, 2024
1 parent 8e4755f commit f4d17be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,37 @@ void comment(StringBuilder declaration) {
.append("{@link ")
.append(annotationMetaEntity.importType(entity))
.append("} by ");
int paramCount = paramNames.size();
for (int i = 0; i < paramCount; i++) {
String param = paramNames.get(i);
if ( i>0 ) {
if ( i + 1 == paramCount) {
declaration
.append(paramCount>2 ? ", and " : " and "); //Oxford comma
}
else {
declaration
.append(", ");
long paramCount = paramTypes.stream()
.filter(type -> !isOrderParam(type) && !isPageParam(type)
&& !isSessionParameter(type))
.count();
int count = 0;
for (int i = 0; i < paramTypes.size(); i++) {
String type = paramTypes.get(i);
if ( !isPageParam(type) && !isOrderParam(type)
&& !isSessionParameter(type) ) {
if ( count>0 ) {
if ( count + 1 == paramCount) {
declaration
.append(paramCount>2 ? ", and " : " and "); //Oxford comma
}
else {
declaration
.append(", ");
}
}
count++;
final String path = paramNames.get(i)
.replace('$', '.');
declaration
.append("{@link ")
.append(annotationMetaEntity.importType(entity))
.append('#')
.append(qualifier(path))
.append(' ')
.append(path)
.append("}");
}
final String path = param.replace('$', '.');
declaration
.append("{@link ")
.append(annotationMetaEntity.importType(entity))
.append('#')
.append(qualifier(path))
.append(' ')
.append(path)
.append("}");
}
declaration
.append('.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ private String getConstantName() {
else {
return stem + "_"
+ paramTypes.stream()
.filter(name -> !isPageParam(name) && !isOrderParam(name))
.filter(type -> !isPageParam(type) && !isOrderParam(type)
&& !isSessionParameter(type))
.map(StringHelper::unqualify)
.reduce((x,y) -> x + '_' + y)
.orElse("");
Expand Down

0 comments on commit f4d17be

Please sign in to comment.