当前位置: 首页>>代码示例>>Java>>正文


Java JDOMUtil.addContent方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:TagBinding.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:BeanBinding.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:OptionTagBinding.java


注:本文中的com.intellij.openapi.util.JDOMUtil.addContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。