本文整理汇总了Java中com.intellij.openapi.util.JDOMUtil.addContent方法的典型用法代码示例。如果您正苦于以下问题:Java JDOMUtil.addContent方法的具体用法?Java JDOMUtil.addContent怎么用?Java JDOMUtil.addContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.JDOMUtil
的用法示例。
在下文中一共展示了JDOMUtil.addContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Nullable
@Override
public Object serialize(@NotNull Object o, @Nullable Object context, @NotNull SerializationFilter filter) {
Object value = myAccessor.read(o);
Element serialized = new Element(myName);
if (value == null) {
return serialized;
}
if (myBinding == null) {
serialized.addContent(new Text(XmlSerializerImpl.convertToString(value)));
}
else {
Object node = myBinding.serialize(value, serialized, filter);
if (node != null && node != serialized) {
JDOMUtil.addContent(serialized, node);
}
}
return serialized;
}
示例2: serializeInto
import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Nullable
public Element serializeInto(@NotNull Object o, @Nullable Element element, @NotNull SerializationFilter filter) {
for (Binding binding : myBindings) {
Accessor accessor = binding.getAccessor();
if (filter instanceof SkipDefaultsSerializationFilter) {
if (((SkipDefaultsSerializationFilter)filter).equal(binding, o)) {
continue;
}
}
else if (!filter.accepts(accessor, o)) {
continue;
}
//todo: optimize. Cache it.
Property property = accessor.getAnnotation(Property.class);
if (property != null && property.filter() != SerializationFilter.class &&
!ReflectionUtil.newInstance(property.filter()).accepts(accessor, o)) {
continue;
}
if (element == null) {
element = new Element(myTagName);
}
Object node = binding.serialize(o, element, filter);
if (node != null) {
if (node instanceof org.jdom.Attribute) {
element.setAttribute((org.jdom.Attribute)node);
}
else {
JDOMUtil.addContent(element, node);
}
}
}
return element;
}
示例3: serialize
import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Override
@Nullable
public Object serialize(@NotNull Object o, @Nullable Object context, @NotNull SerializationFilter filter) {
Object value = myAccessor.read(o);
Element targetElement = new Element(myTagName);
if (!StringUtil.isEmpty(myNameAttribute)) {
targetElement.setAttribute(myNameAttribute, myName);
}
if (value == null) {
return targetElement;
}
if (myConverter == null) {
if (myBinding == null) {
targetElement.setAttribute(myValueAttribute, XmlSerializerImpl.convertToString(value));
}
else if (myBinding instanceof BeanBinding && myValueAttribute.isEmpty()) {
((BeanBinding)myBinding).serializeInto(value, targetElement, filter);
}
else {
Object node = myBinding.serialize(value, targetElement, filter);
if (node != null && targetElement != node) {
JDOMUtil.addContent(targetElement, node);
}
}
}
else {
targetElement.setAttribute(myValueAttribute, myConverter.toString(value));
}
return targetElement;
}