Skip to content

Commit

Permalink
whitespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Jun 26, 2023
1 parent bec6cfa commit 5141e2b
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private void addPersistentMembers(List<? extends Element> membersOfClass, Access

private void addQueryMethods(List<ExecutableElement> queryMethods) {
for ( ExecutableElement method : queryMethods) {
addQueryMethod(method);
addQueryMethod( method );
}
}

Expand All @@ -309,27 +309,27 @@ private void addQueryMethod(ExecutableElement method) {
addQueryMethod(method, methodName, typeName, null);
}
else {
if (isLegalRawResultType(typeName)) {
addQueryMethod(method, methodName, null, typeName);
if ( isLegalRawResultType( typeName ) ) {
addQueryMethod( method, methodName, null, typeName );
}
else {
// probably a projection
addQueryMethod(method, methodName, typeName, null);
addQueryMethod( method, methodName, typeName, null );
}
}
}
else if ( typeArguments.size() == 1 ) {
final String containerTypeName = declaredType.asElement().toString();
final String returnTypeName = typeArguments.get(0).toString();
if (isLegalGenericResultType(containerTypeName)) {
addQueryMethod(method, methodName, returnTypeName, containerTypeName);
if ( isLegalGenericResultType( containerTypeName ) ) {
addQueryMethod( method, methodName, returnTypeName, containerTypeName );
}
else {
displayError(method, "incorrect return type '" + containerTypeName + "'");
displayError( method, "incorrect return type '" + containerTypeName + "'" );
}
}
else {
displayError(method, "incorrect return type '" + declaredType + "'");
displayError( method, "incorrect return type '" + declaredType + "'" );
}
}
}
Expand All @@ -352,13 +352,13 @@ private void addQueryMethod(
String methodName,
@Nullable String returnTypeName,
@Nullable String containerTypeName) {
final AnnotationMirror hql = getAnnotationMirror(method, Constants.HQL);
final AnnotationMirror hql = getAnnotationMirror( method, Constants.HQL );
if ( hql != null ) {
addQueryMethod(method, methodName, returnTypeName, containerTypeName, hql, false);
addQueryMethod( method, methodName, returnTypeName, containerTypeName, hql, false );
}
final AnnotationMirror sql = getAnnotationMirror(method, Constants.SQL);
final AnnotationMirror sql = getAnnotationMirror( method, Constants.SQL );
if ( sql != null ) {
addQueryMethod(method, methodName, returnTypeName, containerTypeName, sql, true);
addQueryMethod( method, methodName, returnTypeName, containerTypeName, sql, true );
}
}

Expand All @@ -371,16 +371,16 @@ private void addQueryMethod(
String containerTypeName,
AnnotationMirror mirror,
boolean isNative) {
final Object queryString = getAnnotationValue(mirror, "value" );
final Object queryString = getAnnotationValue( mirror, "value" );
if ( queryString instanceof String ) {
final List<String> paramNames =
method.getParameters().stream()
.map(param -> param.getSimpleName().toString())
.collect(toList());
.map( param -> param.getSimpleName().toString() )
.collect( toList() );
final List<String> paramTypes =
method.getParameters().stream()
.map(param -> param.asType().toString())
.collect(toList());
.map( param -> param.asType().toString() )
.collect( toList() );
final String hql = (String) queryString;
final QueryMethod attribute =
new QueryMethod(
Expand All @@ -395,9 +395,9 @@ private void addQueryMethod(
);
putMember( attribute.getPropertyName(), attribute );

checkParameters(method, paramNames, mirror, hql);
if (!isNative) {
checkHqlSyntax(method, mirror, hql);
checkParameters( method, paramNames, mirror, hql );
if ( !isNative ) {
checkHqlSyntax( method, mirror, hql );
}
}
}
Expand All @@ -406,8 +406,8 @@ private void checkParameters(ExecutableElement method, List<String> paramNames,
for (int i = 1; i <= paramNames.size(); i++) {
final String param = paramNames.get(i-1);
if ( !hql.contains(":" + param) && !hql.contains("?" + i) ) {
displayError(method, mirror, "missing query parameter for '" + param
+ "' (no parameter named :" + param + " or ?" + i + ")");
displayError( method, mirror, "missing query parameter for '" + param
+ "' (no parameter named :" + param + " or ?" + i + ")" );
}
}
}
Expand All @@ -416,8 +416,8 @@ private void checkHqlSyntax(ExecutableElement method, AnnotationMirror mirror, S
ANTLRErrorListener errorListener = new ANTLRErrorListener() {
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String message, RecognitionException e) {
displayError(method, mirror, "illegal HQL syntax - "
+ prettifyAntlrError( offendingSymbol, line, charPositionInLine, message, e, queryString, false ));
displayError( method, mirror, "illegal HQL syntax - "
+ prettifyAntlrError( offendingSymbol, line, charPositionInLine, message, e, queryString, false ) );
}

@Override
Expand Down

0 comments on commit 5141e2b

Please sign in to comment.