code: void assertParent(Collection<Class<? extends Element>> permittedParents) throws InvalidInputException {
      if (!permittedParents.contains(this.getParent().getClass())) {
        throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" is not allowed as a child of \""
            + this.getParent().getMessageMLTag() + "\"");
      }
    }
docs: Check that the element's allowed parents are limited to the specified element types.