simplify some code in SchemaAutoTooling

This commit is contained in:
Gavin King 2022-02-02 22:10:48 +01:00
parent 4904f64b2e
commit c41c5c7472
1 changed files with 7 additions and 19 deletions

View File

@ -56,28 +56,16 @@ public enum SchemaAutoTooling {
return null;
}
configurationValue = configurationValue.trim();
if ( configurationValue.isEmpty() || NONE.externalForm.equals( configurationValue ) ) {
if ( configurationValue.isEmpty()
|| NONE.externalForm.equals( configurationValue ) ) {
return null;
}
else if ( VALIDATE.externalForm.equals( configurationValue ) ) {
return VALIDATE;
}
else if ( UPDATE.externalForm.equals( configurationValue ) ) {
return UPDATE;
}
else if ( CREATE.externalForm.equals( configurationValue ) ) {
return CREATE;
}
else if ( CREATE_DROP.externalForm.equals( configurationValue ) ) {
return CREATE_DROP;
}
else if ( CREATE_ONLY.externalForm.equals( configurationValue ) ) {
return CREATE_ONLY;
}
else if ( DROP.externalForm.equals( configurationValue ) ) {
return DROP;
}
else {
for ( SchemaAutoTooling sat : values() ) {
if ( sat.externalForm.equals( configurationValue ) ) {
return sat;
}
}
throw new HibernateException(
"Unrecognized " + AvailableSettings.HBM2DDL_AUTO + " value: '" + configurationValue
+ "'. Supported values include 'create', 'create-drop', 'create-only', 'drop', 'update', 'none' and 'validate'."