|
19 | 19 |
|
20 | 20 | package org.apache.cayenne.access.jdbc; |
21 | 21 |
|
22 | | -import java.sql.ResultSetMetaData; |
23 | | -import java.sql.SQLException; |
24 | | - |
25 | 22 | import org.apache.cayenne.dba.TypesMapping; |
26 | 23 | import org.apache.cayenne.map.DbAttribute; |
27 | 24 | import org.apache.cayenne.map.ObjAttribute; |
28 | 25 | import org.apache.cayenne.map.ProcedureParameter; |
| 26 | +import org.apache.cayenne.util.ToStringBuilder; |
29 | 27 |
|
| 28 | +import java.sql.ResultSetMetaData; |
| 29 | +import java.sql.SQLException; |
30 | 30 | import java.util.Objects; |
31 | | -import org.apache.cayenne.util.ToStringBuilder; |
32 | 31 |
|
33 | 32 | /** |
34 | 33 | * A descriptor of a ResultSet column. |
@@ -140,10 +139,10 @@ public ColumnDescriptor(ResultSetMetaData metaData, int position) throws SQLExce |
140 | 139 |
|
141 | 140 | private static String getColumnNameFromMeta(ResultSetMetaData metaData, int position) throws SQLException { |
142 | 141 | String name = metaData.getColumnLabel(position); |
143 | | - if (name == null || name.length() == 0) { |
| 142 | + if (name == null || name.isEmpty()) { |
144 | 143 | name = metaData.getColumnName(position); |
145 | 144 |
|
146 | | - if (name == null || name.length() == 0) { |
| 145 | + if (name == null || name.isEmpty()) { |
147 | 146 | name = "column_" + position; |
148 | 147 | } |
149 | 148 | } |
@@ -174,11 +173,10 @@ public void setAttribute(DbAttribute attribute) { |
174 | 173 | */ |
175 | 174 | @Override |
176 | 175 | public boolean equals(Object o) { |
177 | | - if (!(o instanceof ColumnDescriptor)) { |
| 176 | + if (!(o instanceof ColumnDescriptor rhs)) { |
178 | 177 | return false; |
179 | 178 | } |
180 | 179 |
|
181 | | - ColumnDescriptor rhs = (ColumnDescriptor) o; |
182 | 180 | return Objects.equals(name, rhs.name) |
183 | 181 | && Objects.equals(namePrefix, rhs.namePrefix) |
184 | 182 | && Objects.equals(procedureName, rhs.procedureName) |
|
0 commit comments