gpt4 book ai didi

org.opendaylight.yangtools.yang.model.repo.api.YinDomSchemaSource类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 06:11:31 28 4
gpt4 key购买 nike

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

YinDomSchemaSource介绍

[英]Utility YinXmlSchemaSource exposing a W3C DOMSource representation of YIN model.
[中]实用工具YinXmlSchemaSource公开了YIN模型的W3C DOMSource表示。

代码示例

代码示例来源: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: org.opendaylight.yangtools/yang-model-api

@Override
public final String toString() {
  return addToStringAttributes(MoreObjects.toStringHelper(this).add("identifier", getIdentifier())).toString();
}

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

public static StatementStreamSource create(final YinDomSchemaSource source) {
  return new YinStatementStreamSource(source.getIdentifier(), source.getSource().getNode());
}

代码示例来源: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

/**
 * 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 on first access,
 * at which point an {@link IllegalStateException} may be raised.
 *
 * @param xmlSchemaSource Backing schema source
 * @return A {@link YinDomSchemaSource} instance
 */
public static @NonNull YinDomSchemaSource lazyTransform(final YinXmlSchemaSource xmlSchemaSource) {
  final YinDomSchemaSource cast = castSchemaSource(xmlSchemaSource);
  return cast != null ? cast : new Transforming(xmlSchemaSource);
}

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

public static StatementStreamSource create(final YinXmlSchemaSource source) throws TransformerException {
  return create(YinDomSchemaSource.transform(source));
}

代码示例来源: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-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 on first access,
 * at which point an {@link IllegalStateException} may be raised.
 *
 * @param xmlSchemaSource Backing schema source
 * @return A {@link YinDomSchemaSource} instance
 */
public static @NonNull YinDomSchemaSource lazyTransform(final YinXmlSchemaSource xmlSchemaSource) {
  final YinDomSchemaSource cast = castSchemaSource(xmlSchemaSource);
  return cast != null ? cast : new Transforming(xmlSchemaSource);
}

代码示例来源: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()));
}

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

@Override
public final String toString() {
  return addToStringAttributes(MoreObjects.toStringHelper(this).add("identifier", getIdentifier())).toString();
}

代码示例来源: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));
  }
}

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