gpt4 book ai didi

org.nuxeo.common.xmap.XMap.register()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 15:00:40 25 4
gpt4 key购买 nike

本文整理了Java中org.nuxeo.common.xmap.XMap.register()方法的一些代码示例,展示了XMap.register()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMap.register()方法的具体详情如下:
包路径:org.nuxeo.common.xmap.XMap
类名称:XMap
方法名:register

XMap.register介绍

[英]Registers a mappable object class.

The class will be scanned for XMap annotations and a mapping description is created.
[中]注册一个可映射的对象类。
该类将被扫描XMap注释,并创建映射描述。

代码示例

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

/**
 * Gets existing descriptor or creates a default one.
 */
protected BinaryManagerRootDescriptor getDescriptor(File configFile) throws IOException {
  BinaryManagerRootDescriptor desc;
  if (configFile.exists()) {
    XMap xmap = new XMap();
    xmap.register(BinaryManagerRootDescriptor.class);
    desc = (BinaryManagerRootDescriptor) xmap.load(new FileInputStream(configFile));
  } else {
    desc = new BinaryManagerRootDescriptor();
    // TODO fetch from repo descriptor
    desc.digest = getDefaultDigestAlgorithm();
    desc.depth = DEFAULT_DEPTH;
    desc.write(configFile); // may throw IOException
  }
  return desc;
}

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core

public static ModuleConfiguration readConfiguration(final WebEngine engine, File file) throws IOException {
  XMap xmap = new XMap();
  xmap.register(ModuleConfiguration.class);
  InputStream in = new BufferedInputStream(new FileInputStream(file));
  ModuleConfiguration mc = (ModuleConfiguration) xmap.load(createXMapContext(engine), in);
  return mc;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-forms-layout-core

@XContent("selectOptions")
public void setSelectOptions(DocumentFragment selectOptionsDOM) {
  XMap xmap = new XMap();
  xmap.register(WidgetSelectOptionDescriptor.class);
  xmap.register(WidgetSelectOptionsDescriptor.class);
  Node p = selectOptionsDOM.getFirstChild();
  List<WidgetSelectOption> options = new ArrayList<WidgetSelectOption>();
  while (p != null) {
    if (p.getNodeType() == Node.ELEMENT_NODE) {
      Object desc = xmap.load((Element) p);
      if (desc instanceof WidgetSelectOptionDescriptor) {
        options.add(((WidgetSelectOptionDescriptor) desc).getWidgetSelectOption());
      } else if (desc instanceof WidgetSelectOptionsDescriptor) {
        options.add(((WidgetSelectOptionsDescriptor) desc).getWidgetSelectOption());
      } else {
        log.error("Unknown resolution of select option");
      }
    }
    p = p.getNextSibling();
  }
  selectOptions = options.toArray(new WidgetSelectOption[0]);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-persistence

public static HibernateConfiguration load(URL location) {
  XMap map = new XMap();
  map.register(HibernateConfiguration.class);
  try {
    return (HibernateConfiguration) map.load(location);
  } catch (IOException e) {
    throw new PersistenceError("Cannot load hibernate configuration from " + location, e);
  }
}

代码示例来源:origin: org.nuxeo.runtime/nuxeo-connect-standalone

xmap.register(PackageDefinitionImpl.class);
xmap.register(FormsDefinition.class);
return xmap;

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public XAnnotatedContent(XMap xmap, XAccessor setter, XContent anno) {
  super(xmap, setter);
  path = new Path(anno.value());
  type = setter.getType();
  valueFactory = xmap.getValueFactory(type);
  xao = xmap.register(type);
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public XAnnotatedMember(XMap xmap, XAccessor setter, XNode anno) {
  this.xmap = xmap;
  accessor = setter;
  path = new Path(anno.value());
  trim = anno.trim();
  type = setter.getType();
  valueFactory = xmap.getValueFactory(type);
  if (valueFactory == null && type.isEnum()) {
    valueFactory = new XValueFactory() {
      @Override
      public String serialize(Context arg0, Object arg1) {
        return ((Enum<?>) arg1).name();
      }
      @SuppressWarnings("unchecked")
      @Override
      public Object deserialize(Context arg0, String arg1) {
        return Enum.valueOf(type, arg1);
      }
    };
    xmap.setValueFactory(type, valueFactory);
  }
  xao = xmap.register(type);
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public XAnnotatedList(XMap xmap, XAccessor setter, XNodeList anno) {
  super(xmap, setter);
  path = new Path(anno.value());
  trim = anno.trim();
  type = anno.type();
  componentType = anno.componentType();
  valueFactory = xmap.getValueFactory(componentType);
  xao = xmap.register(componentType);
  isNullByDefault = anno.nullByDefault();
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public XAnnotatedMap(XMap xmap, XAccessor setter, XNodeMap anno) {
  super(xmap, setter);
  path = new Path(anno.value());
  trim = anno.trim();
  key = new Path(anno.key());
  type = anno.type();
  componentType = anno.componentType();
  valueFactory = xmap.getValueFactory(componentType);
  xao = xmap.register(componentType);
  isNullByDefault = anno.nullByDefault();
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com