ParentType (final ConvertContext context) { ParentType parent = context.getInvocationElement().getParentOfType(myDomMethodClass, true); assert parent != null: "Can't get parent of type " + myDomMethodClass + " for " + context.getInvocationElement(); return parent; }