Introduce identifierNameToUse() in GenericCallMetaDataProvider

This commit is contained in:
Sam Brannen 2023-09-08 13:59:46 +02:00
parent 4df3eb4670
commit ab5d46411a
1 changed files with 22 additions and 50 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2021 the original author or authors. * Copyright 2002-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,7 +35,8 @@ import org.springframework.util.StringUtils;
/** /**
* A generic implementation of the {@link CallMetaDataProvider} interface. * A generic implementation of the {@link CallMetaDataProvider} interface.
* This class can be extended to provide database specific behavior. *
* <p>This class can be extended to provide database specific behavior.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller
@ -124,52 +125,19 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
@Override @Override
@Nullable @Nullable
public String procedureNameToUse(@Nullable String procedureName) { public String procedureNameToUse(@Nullable String procedureName) {
if (procedureName == null) { return identifierNameToUse(procedureName);
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return procedureName.toUpperCase();
}
else if (isStoresLowerCaseIdentifiers()) {
return procedureName.toLowerCase();
}
else {
return procedureName;
}
} }
@Override @Override
@Nullable @Nullable
public String catalogNameToUse(@Nullable String catalogName) { public String catalogNameToUse(@Nullable String catalogName) {
if (catalogName == null) { return identifierNameToUse(catalogName);
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return catalogName.toUpperCase();
}
else if (isStoresLowerCaseIdentifiers()) {
return catalogName.toLowerCase();
}
else {
return catalogName;
}
} }
@Override @Override
@Nullable @Nullable
public String schemaNameToUse(@Nullable String schemaName) { public String schemaNameToUse(@Nullable String schemaName) {
if (schemaName == null) { return identifierNameToUse(schemaName);
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return schemaName.toUpperCase();
}
else if (isStoresLowerCaseIdentifiers()) {
return schemaName.toLowerCase();
}
else {
return schemaName;
}
} }
@Override @Override
@ -197,18 +165,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
@Override @Override
@Nullable @Nullable
public String parameterNameToUse(@Nullable String parameterName) { public String parameterNameToUse(@Nullable String parameterName) {
if (parameterName == null) { return identifierNameToUse(parameterName);
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return parameterName.toUpperCase();
}
else if (isStoresLowerCaseIdentifiers()) {
return parameterName.toLowerCase();
}
else {
return parameterName;
}
} }
@Override @Override
@ -316,6 +273,21 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
} }
private String identifierNameToUse(@Nullable String identifierName) {
if (identifierName == null) {
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return identifierName.toUpperCase();
}
else if (isStoresLowerCaseIdentifiers()) {
return identifierName.toLowerCase();
}
else {
return identifierName;
}
}
/** /**
* Process the procedure column meta-data. * Process the procedure column meta-data.
*/ */