@Override public boolean isValueCompatible(FieldValue value) { if (!(value instanceof Document)) { return false; } Document doc = (Document) value; if (doc.getDataType().inherits(this)) { //the value is of this type; or the supertype of the value is of this type, etc.... return true; } return false; }
/** * Return whether this document type inherits the given document type. * * @param superType The documenttype to check if it inherits. * @return true if it inherits the superType, false if not */ public boolean inherits(DocumentType superType) { if (equals(superType)) return true; for (DocumentType type : inherits) { if (type.inherits(superType)) return true; } return false; }