private boolean implementsInterface(SClass<?> interfaze) { if (this.equals(interfaze)) { return true; } for (SClass<?> ifs : this.getInterfaces()) { if (ifs.implementsInterface(interfaze)) { return true; } } SClass<?> superclass = getSuperclass(); return superclass != null ? superclass.implementsInterface(interfaze) : false; }
public final boolean isAssignableFrom(SClass<?> that) { if (this == that) { return true; } String thisDescriptor = this.getDescriptor(); String thatDescriptor = that.getDescriptor(); if (thisDescriptor.equals(thatDescriptor)) { return true; } if (this.isPrimitive() || that.isPrimitive()) { return false; } if (ObjectClass.getDescriptor().equals(thisDescriptor)) { return true; } if (this.isArray()) { if (!that.isArray()) { return false; } return this.getComponentType().isAssignableFrom(that.getComponentType()); } if (this.isInterface()) { return that.implementsInterface(this); } SClass<?> superclass = that.getSuperclass(); while (superclass != null) { if (superclass.getDescriptor().equals(thisDescriptor)) { return true; } superclass = superclass.getSuperclass(); } return false; }