static Format checkRawType(Catalog catalog, Object o, Format declaredFormat) { assert declaredFormat != null; Format format; if (o instanceof RawObject) { format = (Format) ((RawObject) o).getType(); } else { format = catalog.getFormat(o.getClass()); if (!format.isSimple() || format.isEnum()) { throw new IllegalArgumentException( "Not a RawObject or a non-enum simple type: " + format.getClassName()); } } if (!format.isAssignableTo(declaredFormat)) { throw new IllegalArgumentException( "Not a subtype of the field's declared class " + declaredFormat.getClassName() + ": " + format.getClassName()); } if (!format.isCurrentVersion()) { throw new IllegalArgumentException( "Raw type version is not current. Class: " + format.getClassName() + " Version: " + format.getVersion()); } Format proxiedFormat = format.getProxiedFormat(); if (proxiedFormat != null) { format = proxiedFormat; } return format; }
@Override boolean isAssignableTo(Format format) { if (super.isAssignableTo(format)) { return true; } if (format instanceof ObjectArrayFormat) { ObjectArrayFormat other = (ObjectArrayFormat) format; if (useComponentFormat.isAssignableTo(other.useComponentFormat)) { return true; } } return false; }