Skip to content

Commit 0bcb894

Browse files
committed
Add deprecated to subclasses too
1 parent c4a542e commit 0bcb894

13 files changed

Lines changed: 249 additions & 85 deletions

src/main/java/com/laytonsmith/core/ArgumentValidation.java

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ private ArgumentValidation() {
4141
//
4242
}
4343

44+
/**
45+
* @deprecated Use {@link #getItemFromArray(CArray, String, Target, Mixed, Environment)} instead.
46+
*/
4447
@Deprecated
4548
public static Mixed getItemFromArray(CArray object, String key, Target t, Mixed defaultItem) throws ConfigRuntimeException {
4649
return getItemFromArray(object, key, t, defaultItem, null);
@@ -71,6 +74,9 @@ public static Mixed getItemFromArray(CArray object, String key, Target t, Mixed
7174
}
7275
}
7376

77+
/**
78+
* @deprecated Use {@link #getArray(Mixed, Target, Environment)} instead.
79+
*/
7480
@Deprecated
7581
public static CArray getArray(Mixed construct, Target t) {
7682
return getArray(construct, t, null);
@@ -120,6 +126,9 @@ public static <T extends Mixed> T getObject(Mixed construct, Target t, Class<T>
120126
}
121127
}
122128

129+
/**
130+
* @deprecated Use {@link #getNumber(Mixed, Target, Environment)} instead.
131+
*/
123132
@Deprecated
124133
public static double getNumber(Mixed c, Target t) {
125134
return getNumber(c, t, null);
@@ -188,6 +197,9 @@ public static double getNumber(Mixed c, Target t, Environment env) {
188197
+ ")[\\x00-\\x20]*" // trailing whitespace
189198
);
190199

200+
/**
201+
* @deprecated Use {@link #isNumber(Mixed, Environment)} instead.
202+
*/
191203
@Deprecated
192204
public static boolean isNumber(Mixed c) {
193205
return isNumber(c, null);
@@ -204,6 +216,9 @@ public static boolean isNumber(Mixed c, Environment env) {
204216
return InstanceofUtil.isInstanceof(c, CNumber.class, env) || VALID_DOUBLE.matcher(c.val()).matches();
205217
}
206218

219+
/**
220+
* @deprecated Use {@link #getDouble(Mixed, Target, Environment)} instead.
221+
*/
207222
@Deprecated
208223
public static double getDouble(Mixed c, Target t) {
209224
return getDouble(c, t, null);
@@ -222,12 +237,15 @@ public static double getDouble(Mixed c, Target t, Environment env) {
222237
c = ((CMutablePrimitive) c).get();
223238
}
224239
try {
225-
return getNumber(c, t);
240+
return getNumber(c, t, env);
226241
} catch (ConfigRuntimeException e) {
227242
throw new CRECastException("Expecting a double, but received " + c.val() + " instead", t);
228243
}
229244
}
230245

246+
/**
247+
* @deprecated Use {@link #getDouble32(Mixed, Target, Environment)} instead.
248+
*/
231249
@Deprecated
232250
public static float getDouble32(Mixed c, Target t) {
233251
return getDouble32(c, t, null);
@@ -244,13 +262,16 @@ public static float getDouble32(Mixed c, Target t) {
244262
* @return
245263
*/
246264
public static float getDouble32(Mixed c, Target t, Environment env) {
247-
double l = getDouble(c, t);
265+
double l = getDouble(c, t, env);
248266
if(Math.abs(l) > Float.MAX_VALUE) {
249267
throw new CRERangeException("Expecting a 32 bit float, but a larger value was found: " + l, t);
250268
}
251269
return (float) l;
252270
}
253271

272+
/**
273+
* @deprecated Use {@link #getInt(Mixed, Target, Environment)} instead.
274+
*/
254275
@Deprecated
255276
public static long getInt(Mixed c, Target t) {
256277
return getInt(c, t, null);
@@ -291,6 +312,9 @@ public static long getInt(Mixed c, Target t, Environment env) {
291312
return i;
292313
}
293314

315+
/**
316+
* @deprecated Use {@link #getInt32(Mixed, Target, Environment)} instead.
317+
*/
294318
@Deprecated
295319
public static int getInt32(Mixed c, Target t) {
296320
return getInt32(c, t, null);
@@ -312,14 +336,17 @@ public static int getInt32(Mixed c, Target t, Environment env) {
312336
if(c instanceof CMutablePrimitive) {
313337
c = ((CMutablePrimitive) c).get();
314338
}
315-
long l = getInt(c, t);
339+
long l = getInt(c, t, env);
316340
int i = (int) l;
317341
if(i != l) {
318342
throw new CRERangeException("Expecting a 32 bit integer, but a larger value was found: " + l, t);
319343
}
320344
return i;
321345
}
322346

347+
/**
348+
* @deprecated Use {@link #getInt16(Mixed, Target, Environment)} instead.
349+
*/
323350
@Deprecated
324351
public static short getInt16(Mixed c, Target t) {
325352
return getInt16(c, t, null);
@@ -341,14 +368,17 @@ public static short getInt16(Mixed c, Target t, Environment env) {
341368
if(c instanceof CMutablePrimitive) {
342369
c = ((CMutablePrimitive) c).get();
343370
}
344-
long l = getInt(c, t);
371+
long l = getInt(c, t, env);
345372
short s = (short) l;
346373
if(s != l) {
347374
throw new CRERangeException("Expecting a 16 bit integer, but a larger value was found: " + l, t);
348375
}
349376
return s;
350377
}
351378

379+
/**
380+
* @deprecated Use {@link #getInt8(Mixed, Target, Environment)} instead.
381+
*/
352382
@Deprecated
353383
public static byte getInt8(Mixed c, Target t) {
354384
return getInt8(c, t, null);
@@ -370,14 +400,17 @@ public static byte getInt8(Mixed c, Target t, Environment env) {
370400
if(c instanceof CMutablePrimitive) {
371401
c = ((CMutablePrimitive) c).get();
372402
}
373-
long l = getInt(c, t);
403+
long l = getInt(c, t, env);
374404
byte b = (byte) l;
375405
if(b != l) {
376406
throw new CRERangeException("Expecting an 8 bit integer, but a larger value was found: " + l, t);
377407
}
378408
return b;
379409
}
380410

411+
/**
412+
* @deprecated Use {@link #getBooleanObject(Mixed, Target, Environment)} instead.
413+
*/
381414
@Deprecated
382415
public static boolean getBooleanObject(Mixed c, Target t) {
383416
return getBooleanObject(c, t, null);
@@ -399,6 +432,9 @@ public static boolean getBooleanObject(Mixed c, Target t, Environment env) {
399432
return getBooleanish(c, t, env);
400433
}
401434

435+
/**
436+
* @deprecated Use {@link #getBoolean(Mixed, Target, Environment)} instead.
437+
*/
402438
@Deprecated
403439
public static boolean getBoolean(Mixed c, Target t) {
404440
return getBoolean(c, t, null);
@@ -422,6 +458,9 @@ public static boolean getBoolean(Mixed c, Target t, Environment env) {
422458
return getBooleanish(c, t, env);
423459
}
424460

461+
/**
462+
* @deprecated Use {@link #getBooleanish(Mixed, Target, Environment)} instead.
463+
*/
425464
@Deprecated
426465
public static boolean getBooleanish(Mixed c, Target t) {
427466
return getBooleanish(c, t, null);
@@ -455,6 +494,9 @@ public static boolean getBooleanish(Mixed c, Target t, Environment env) {
455494
throw new CRECastException("Could not convert value of type " + c.typeof() + " to a " + Booleanish.TYPE, t);
456495
}
457496

497+
/**
498+
* @deprecated Use {@link #getByteArray(Mixed, Target, Environment)} instead.
499+
*/
458500
@Deprecated
459501
public static CByteArray getByteArray(Mixed c, Target t) {
460502
return getByteArray(c, t, null);
@@ -498,6 +540,9 @@ public static String getString(Mixed c, Target t) {
498540
return c.val();
499541
}
500542

543+
/**
544+
* @deprecated Use {@link #getStringObject(Mixed, Target, Environment)} instead.
545+
*/
501546
@Deprecated
502547
public static String getStringObject(Mixed c, Target t) {
503548
return getStringObject(c, t, null);
@@ -519,6 +564,9 @@ public static String getStringObject(Mixed c, Target t, Environment env) {
519564
return c.val();
520565
}
521566

567+
/**
568+
* @deprecated Use {@link #anyDoubles(Environment, Mixed...)} instead.
569+
*/
522570
@Deprecated
523571
public static boolean anyDoubles(Mixed... c) {
524572
return anyDoubles(null, c);
@@ -540,6 +588,9 @@ public static boolean anyDoubles(Environment env, Mixed... c) {
540588
return false;
541589
}
542590

591+
/**
592+
* @deprecated Use {@link #anyStrings(Environment, Mixed...)} instead.
593+
*/
543594
@Deprecated
544595
public static boolean anyStrings(Mixed... c) {
545596
return anyStrings(null, c);
@@ -561,6 +612,9 @@ public static boolean anyStrings(Environment env, Mixed... c) {
561612
return false;
562613
}
563614

615+
/**
616+
* @deprecated Use {@link #anyNulls(Environment, Mixed...)} instead.
617+
*/
564618
@Deprecated
565619
public static boolean anyNulls(Mixed... c) {
566620
return anyNulls(null, c);
@@ -582,6 +636,9 @@ public static boolean anyNulls(Environment env, Mixed... c) {
582636
return false;
583637
}
584638

639+
/**
640+
* @deprecated Use {@link #anyBooleans(Environment, Mixed...)} instead.
641+
*/
585642
@Deprecated
586643
public static boolean anyBooleans(Mixed... c) {
587644
return anyBooleans(null, c);
@@ -631,6 +688,9 @@ public static <T extends Enum<T>> T getEnum(Mixed c, Class<T> enumClass, Target
631688
}
632689
}
633690

691+
/**
692+
* @deprecated Use {@link #getEnumSet(Mixed, Class, Target, Environment)} instead.
693+
*/
634694
@Deprecated
635695
public static <T extends Enum<T>> Set<T> getEnumSet(Mixed c, Class<T> enumClass, Target t) {
636696
return getEnumSet(c, enumClass, t, null);

0 commit comments

Comments
 (0)