gpt4 book ai didi

org.opendaylight.yangtools.yang.model.repo.api.YinDomSchemaSource.create()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 07:05:31 27 4
gpt4 key购买 nike

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

YinDomSchemaSource.create介绍

[英]Create a new YinDomSchemaSource using an identifier and a source.
[中]使用标识符和源创建新的YinDomSchemaSource。

代码示例

代码示例来源:origin: org.opendaylight.yangtools/yang-model-api

private static @Nullable YinDomSchemaSource castSchemaSource(final YinXmlSchemaSource xmlSchemaSource) {
  if (xmlSchemaSource instanceof YinDomSchemaSource) {
    return (YinDomSchemaSource) xmlSchemaSource;
  }
  final Source source = xmlSchemaSource.getSource();
  if (source instanceof DOMSource) {
    return create(xmlSchemaSource.getIdentifier(), (DOMSource) source);
  }
  return null;
}

代码示例来源:origin: opendaylight/yangtools

private static @Nullable YinDomSchemaSource castSchemaSource(final YinXmlSchemaSource xmlSchemaSource) {
  if (xmlSchemaSource instanceof YinDomSchemaSource) {
    return (YinDomSchemaSource) xmlSchemaSource;
  }
  final Source source = xmlSchemaSource.getSource();
  if (source instanceof DOMSource) {
    return create(xmlSchemaSource.getIdentifier(), (DOMSource) source);
  }
  return null;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

public static YinDomSchemaSource transformSource(final YinTextSchemaSource source) throws SAXException,
      IOException {
    final Document doc = UntrustedXML.newDocumentBuilder().newDocument();
    final SAXParser parser = UntrustedXML.newSAXParser();
    final DefaultHandler handler = new StatementSourceReferenceHandler(doc, null);
    parser.parse(source.openStream(), handler);
    return YinDomSchemaSource.create(source.getIdentifier(), new DOMSource(doc));
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-api

/**
 * Create a {@link YinDomSchemaSource} from a {@link YinXmlSchemaSource}. If the argument is already a
 * YinDomSchemaSource, this method returns the same instance. The source will be translated immediately.
 *
 * @param xmlSchemaSource Backing schema source
 * @return A {@link YinDomSchemaSource} instance
 * @throws TransformerException when the provided source fails to transform
 */
public static @NonNull YinDomSchemaSource transform(final YinXmlSchemaSource xmlSchemaSource)
    throws TransformerException {
  final YinDomSchemaSource cast = castSchemaSource(xmlSchemaSource);
  return cast != null ? cast :
    create(xmlSchemaSource.getIdentifier(), transformSource(xmlSchemaSource.getSource()));
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Create a {@link YinDomSchemaSource} from a {@link YinXmlSchemaSource}. If the argument is already a
 * YinDomSchemaSource, this method returns the same instance. The source will be translated immediately.
 *
 * @param xmlSchemaSource Backing schema source
 * @return A {@link YinDomSchemaSource} instance
 * @throws TransformerException when the provided source fails to transform
 */
public static @NonNull YinDomSchemaSource transform(final YinXmlSchemaSource xmlSchemaSource)
    throws TransformerException {
  final YinDomSchemaSource cast = castSchemaSource(xmlSchemaSource);
  return cast != null ? cast :
    create(xmlSchemaSource.getIdentifier(), transformSource(xmlSchemaSource.getSource()));
}

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