mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Clean up Type_ classes
This commit is contained in:
@@ -66,13 +66,13 @@ public class Gfobj_wtr__json {
|
||||
Object[] ary_obj = ((Gfobj_ary)ary).Ary_obj();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Object sub_itm = ary_obj[i];
|
||||
Class<?> sub_itm_type = Type_adp_.ClassOf_obj(sub_itm);
|
||||
if (Type_adp_.Eq(sub_itm_type, Gfobj_ary.class)) {
|
||||
Class<?> sub_itm_type = Type_.Type_by_obj(sub_itm);
|
||||
if (Type_.Eq(sub_itm_type, Gfobj_ary.class)) {
|
||||
wtr.Ary_bgn_ary();
|
||||
Write_ary((Gfobj_ary)sub_itm);
|
||||
wtr.Ary_end();
|
||||
}
|
||||
else if (Type_adp_.Eq(sub_itm_type, Gfobj_nde.class)) {
|
||||
else if (Type_.Eq(sub_itm_type, Gfobj_nde.class)) {
|
||||
wtr.Nde_bgn_ary();
|
||||
Write_nde((Gfobj_nde)sub_itm);
|
||||
wtr.Nde_end();
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface Tst_chkr {
|
||||
class Tst_chkr_null implements Tst_chkr {
|
||||
public Class<?> TypeOf() {return Object.class;}
|
||||
public int Chk(Tst_mgr mgr, String path, Object actl) {
|
||||
mgr.Results().Add(Tst_itm.fail_("!=", path, "<cast type>", "<NULL TYPE>", Type_adp_.NameOf_obj(actl)));
|
||||
mgr.Results().Add(Tst_itm.fail_("!=", path, "<cast type>", "<NULL TYPE>", Type_.Name_by_obj(actl)));
|
||||
// mgr.Results().Add(Tst_itm.fail_("!=", path, "<cast value>", "<NULL VAL>", Object_.Xto_str_strict_or_null(actl)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Tst_mgr {
|
||||
String path = ownerPath + Int_.To_str(i);
|
||||
Tst_chkr expd_obj = i < expd_ary_len ? expd_ary[i] : Tst_mgr.Null_chkr;
|
||||
Object actl_obj = i < actl_ary_len ? actl_ary[i] : "<NULL OBJ>";
|
||||
String actl_type = i < actl_ary_len ? Type_adp_.NameOf_obj(actl_obj) : "<NULL TYPE>";
|
||||
String actl_type = i < actl_ary_len ? Type_.Name_by_obj(actl_obj) : "<NULL TYPE>";
|
||||
err += Tst_inner(expd_obj, actl_obj, actl_type, path, err);
|
||||
}
|
||||
if (throwError && err > 0) {
|
||||
@@ -61,15 +61,15 @@ public class Tst_mgr {
|
||||
}
|
||||
}
|
||||
public int Tst_sub_obj(Tst_chkr expd, Object actl, String path, int err) {
|
||||
return Tst_inner(expd, actl, actl == null ? "<NULL>" : Type_adp_.NameOf_obj(actl), path, err);
|
||||
return Tst_inner(expd, actl, actl == null ? "<NULL>" : Type_.Name_by_obj(actl), path, err);
|
||||
}
|
||||
public int Tst_sub_ary(Tst_chkr[] expd_subs, Object[] actl_subs, String path, int err) {
|
||||
Tst_ary_inner(path + ".", expd_subs, actl_subs);
|
||||
return err;
|
||||
}
|
||||
int Tst_inner(Tst_chkr expd_obj, Object actl_obj, String actl_type, String path, int err) {
|
||||
if (actl_obj == null || !Type_adp_.IsAssignableFrom(expd_obj.TypeOf(), actl_obj.getClass())) {
|
||||
results.Add(Tst_itm.fail_("!=", path, "<cast type>", Type_adp_.NameOf_type(expd_obj.TypeOf()), actl_type));
|
||||
if (actl_obj == null || !Type_.Is_assignable_from(expd_obj.TypeOf(), actl_obj.getClass())) {
|
||||
results.Add(Tst_itm.fail_("!=", path, "<cast type>", Type_.Name(expd_obj.TypeOf()), actl_type));
|
||||
return 1;
|
||||
// results.Add(Tst_itm.fail_("!=", path, "<cast value>", Object_.Xto_str_strict_or_null(expd_obj.ValueOf()), Object_.Xto_str_strict_or_null(actl_obj)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user