diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java index 6167cb13d..efbc3ac7f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008 the original author or authors. + * Copyright 2006-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.springframework.jdbc.support.incrementer.SqlServerMaxValueIncrementer import org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer; import static org.springframework.batch.support.DatabaseType.DB2; +import static org.springframework.batch.support.DatabaseType.DB2AS400; import static org.springframework.batch.support.DatabaseType.DB2ZOS; import static org.springframework.batch.support.DatabaseType.DERBY; import static org.springframework.batch.support.DatabaseType.H2; @@ -62,9 +63,9 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV private String incrementerColumnName = "ID"; /** - * Public setter for the column name (defaults to "ID") in the incrementer. - * Only used by some platforms (Derby, HSQL, MySQL, SQL Server and Sybase), - * and should be fine for use with Spring Batch meta data as long as the +- * Public setter for the column name (defaults to "ID") in the incrementer. +- * Only used by some platforms (Derby, HSQL, MySQL, SQL Server and Sybase), +- * and should be fine for use with Spring Batch meta data as long as the * default batch schema hasn't been changed. * * @param incrementerColumnName the primary key column name to set @@ -77,11 +78,11 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV this.dataSource = dataSource; } - @Override + @Override public DataFieldMaxValueIncrementer getIncrementer(String incrementerType, String incrementerName) { DatabaseType databaseType = DatabaseType.valueOf(incrementerType.toUpperCase()); - if (databaseType == DB2) { + if (databaseType == DB2 || databaseType == DB2AS400) { return new DB2SequenceMaxValueIncrementer(dataSource, incrementerName); } else if (databaseType == DB2ZOS) { @@ -117,9 +118,8 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV return new SybaseMaxValueIncrementer(dataSource, incrementerName, incrementerColumnName); } throw new IllegalArgumentException("databaseType argument was not on the approved list"); - } - + @Override public boolean isSupportedIncrementerType(String incrementerType) { for (DatabaseType type : DatabaseType.values()) { @@ -134,7 +134,7 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV @Override public String[] getSupportedIncrementerTypes() { - List types = new ArrayList(); + List types = new ArrayList<>(); for (DatabaseType type : DatabaseType.values()) { types.add(type.name()); @@ -142,4 +142,4 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV return types.toArray(new String[types.size()]); } -} +} \ No newline at end of file