Object (@NotNull Object o, @Nullable Object context, @Nullable SerializationFilter filter) { Object value = myAccessor.read(o); if (value == null) { return null; } if (value instanceof Element) { Element targetElement = ((Element)value).clone(); assert targetElement != null; targetElement.setName(myTagName); return targetElement; } if (value instanceof Element[]) { ArrayList<Element> result = new ArrayList<>(); for (Element element : ((Element[])value)) { result.add(element.clone().setName(myTagName)); } return result; } throw new XmlSerializationException("org.jdom.Element expected but " + value + " found"); }