Skip to content

Commit c428714

Browse files
committed
fixup
1 parent bb1beed commit c428714

1 file changed

Lines changed: 47 additions & 48 deletions

File tree

src/main/java/io/kurrent/dbclient/v2/Metadata.java

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -136,71 +136,70 @@ public <T> Optional<T> tryGet(String key, Class<T> type) {
136136
return Optional.empty();
137137

138138
// Handle common value types with parsing
139-
try {
140-
if (type == Boolean.class || type == boolean.class) {
141-
Boolean value = BooleanUtils.toBooleanObject(stringValue);
139+
if (type == Boolean.class || type == boolean.class) {
140+
Boolean value = BooleanUtils.toBooleanObject(stringValue);
142141

143-
if (value == null)
144-
return Optional.empty();
142+
if (value == null)
143+
return Optional.empty();
145144

146-
return Optional.of((T) value);
147-
}
145+
return Optional.of((T) value);
146+
}
148147

149-
if (type == Byte.class || type == byte.class) {
150-
byte value = NumberUtils.toByte(stringValue);
151-
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
152-
return Optional.empty();
148+
if (type == Byte.class || type == byte.class) {
149+
byte value = NumberUtils.toByte(stringValue);
150+
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
151+
return Optional.empty();
153152

154-
return Optional.of((T) Byte.valueOf(value));
155-
}
153+
return Optional.of((T) Byte.valueOf(value));
154+
}
156155

157-
if (type == Short.class || type == short.class) {
158-
short value = NumberUtils.toShort(stringValue);
159-
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
160-
return Optional.empty();
156+
if (type == Short.class || type == short.class) {
157+
short value = NumberUtils.toShort(stringValue);
158+
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
159+
return Optional.empty();
161160

162-
return Optional.of((T) Short.valueOf(stringValue));
163-
}
161+
return Optional.of((T) Short.valueOf(stringValue));
162+
}
164163

165-
if (type == Integer.class || type == int.class) {
166-
int value = NumberUtils.toInt(stringValue);
167-
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
168-
return Optional.empty();
164+
if (type == Integer.class || type == int.class) {
165+
int value = NumberUtils.toInt(stringValue);
166+
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
167+
return Optional.empty();
169168

170-
return Optional.of((T) Integer.valueOf(stringValue));
171-
}
169+
return Optional.of((T) Integer.valueOf(stringValue));
170+
}
172171

173-
if (type == Long.class || type== long.class) {
174-
long value = NumberUtils.toLong(stringValue);
175-
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
176-
return Optional.empty();
172+
if (type == Long.class || type == long.class) {
173+
long value = NumberUtils.toLong(stringValue);
174+
if (value == 0 && !stringValue.equalsIgnoreCase("0"))
175+
return Optional.empty();
177176

178-
return Optional.of((T) Long.valueOf(stringValue));
179-
}
177+
return Optional.of((T) Long.valueOf(stringValue));
178+
}
180179

181-
if (type == Float.class || type == float.class) {
182-
float value = NumberUtils.toFloat(stringValue, Float.NaN);
183-
if (Float.isNaN(value))
184-
return Optional.empty();
180+
if (type == Float.class || type == float.class) {
181+
float value = NumberUtils.toFloat(stringValue, Float.NaN);
182+
if (Float.isNaN(value))
183+
return Optional.empty();
185184

186-
return Optional.of((T) Float.valueOf(value));
187-
}
185+
return Optional.of((T) Float.valueOf(value));
186+
}
188187

189-
if (type == Double.class || type == double.class) {
190-
double value = NumberUtils.toDouble(stringValue, Double.NaN);
191-
if (Double.isNaN(value))
192-
return Optional.empty();
188+
if (type == Double.class || type == double.class) {
189+
double value = NumberUtils.toDouble(stringValue, Double.NaN);
190+
if (Double.isNaN(value))
191+
return Optional.empty();
193192

194-
return Optional.of((T) Double.valueOf(value));
193+
return Optional.of((T) Double.valueOf(value));
195194

196-
}
195+
}
197196

198-
if (type == Character.class || type == char.class) {
199-
if (stringValue.length() == 1) {
200-
return Optional.of((T) Character.valueOf(stringValue.charAt(0)));
201-
}
202-
}
197+
if (type == Character.class || type == char.class) {
198+
if (stringValue.length() == 1)
199+
return Optional.of((T) Character.valueOf(stringValue.charAt(0)));
200+
}
203201

202+
try {
204203
if (type == UUID.class)
205204
return Optional.of((T) UUID.fromString(stringValue));
206205

0 commit comments

Comments
 (0)