gpt4 book ai didi

org.onosproject.yang.compiler.utils.io.impl.YangIoUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 21:18:03 26 4
gpt4 key购买 nike

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

YangIoUtils介绍

[英]Represents common utility functionalities for code generation.
[中]

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns the directory path of the package in canonical form.
 *
 * @param baseCodeGenPath base path where the generated files needs to be
 *                        put
 * @param pathOfJavaPkg   java package of the file being generated
 * @return absolute path of the package in canonical form
 */
public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
  if (pathOfJavaPkg.charAt(pathOfJavaPkg.length() - 1) == File.separatorChar) {
    pathOfJavaPkg = trimAtLast(pathOfJavaPkg, SLASH);
  }
  String[] strArray = pathOfJavaPkg.split(SLASH);
  if (strArray[0].equals(EMPTY_STRING)) {
    return pathOfJavaPkg;
  } else {
    return baseCodeGenPath + SLASH + pathOfJavaPkg;
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Adds prefix, if the string begins with digit or is a java key word.
 *
 * @param camelCasePrefix  string for adding prefix
 * @param conflictResolver object of YANG to java naming conflict util
 * @return prefixed camel case string
 */
private static String addPrefix(String camelCasePrefix, YangToJavaNamingConflictUtil conflictResolver) {
  String prefix = getPrefixForIdentifier(conflictResolver);
  if (camelCasePrefix.matches(REGEX_FOR_FIRST_DIGIT)) {
    camelCasePrefix = prefix + camelCasePrefix;
  }
  if (JAVA_KEY_WORDS.contains(camelCasePrefix)) {
    camelCasePrefix = prefix + camelCasePrefix.substring(0, 1).toUpperCase()
        + camelCasePrefix.substring(1);
  }
  return camelCasePrefix;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns javadoc start line.
 *
 * @param name    name of attribute
 * @param javaDoc type of javadoc
 * @return javadoc start line
 */
private static String getJavaDocStartLine(String name, String javaDoc) {
  return FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE +
      FOUR_SPACE_INDENTATION + javaDoc + getSmallCase(name) +
      PERIOD + NEW_LINE;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

if (compilerAnnotation != null) {
  compilerAnnotation = compilerAnnotation.toLowerCase();
  compilerAnnotation = getCapitalCase(compilerAnnotation);
  switch (compilerAnnotation) {
    case QUEUE: {

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

String ruleCheckerWithPrefix = addPrefix(ruleChecker, conflictResolver);
return restrictConsecutiveCapitalCase(ruleCheckerWithPrefix);

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Removes empty directory.
 *
 * @param path path to be checked
 */
public static void removeEmptyDirectory(String path) {
  int index;
  while (path != null && !path.isEmpty()) {
    if (!removeDirectory(path)) {
      break;
    } else {
      index = path.lastIndexOf(SLASH);
      path = path.substring(0, index);
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

return applyCamelCaseRule(stringArray, conflictResolver);

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

boolean isChildNode) throws IOException {
pack = parsePkg(pack);
try {

代码示例来源:origin: org.onosproject/onos-yang-compiler-tool

createDirectories(resourceGenDir);

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

if (this instanceof RpcNotificationContainer) {
  ((RpcNotificationContainer) this).addToIdentityTypedefMap(
      YangIoUtils.getCamelCase(newChild.getName(), null), newChild);

代码示例来源:origin: org.onosproject/onos-yang-runtime-uils

/**
 * Returns schema node's generated interface class name.
 *
 * @param schemaNode schema node
 * @return schema node's generated interface class name
 */
public static String getInterfaceClassName(YangSchemaNode schemaNode) {
  return schemaNode.getJavaPackage() + PERIOD +
      getCapitalCase(schemaNode.getJavaClassNameOrBuiltInType());
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns javaDocs for add to list method.
 *
 * @param attribute  attribute
 * @param annotation compile annotation
 * @return javaDocs
 */
private static String generateForAddToList(String attribute, String annotation) {
  StringBuilder javadoc = new StringBuilder();
  javadoc.append(getJavaDocStartLine(attribute, JAVA_DOC_ADD_TO_LIST))
      .append(getJavaDocEmptyAsteriskLine());
  if (annotation != null) {
    annotation = annotation.toLowerCase();
    annotation = getCapitalCase(annotation);
    switch (annotation) {
      case MAP:
        javadoc.append(getJavaDocParamLine(
            attribute, attribute + KEYS)).append(getJavaDocParamLine(
            attribute, attribute + VALUE_CAPS));
        break;
      default:
        javadoc.append(getJavaDocParamLine(
            attribute, ADD_STRING + TO_CAPS));
        break;
    }
  }
  javadoc.append(getJavaDocParamLine(attribute, ADD_STRING + TO_CAPS))
      .append(getJavaDocEndLine());
  return javadoc.toString();
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns javadoc return line.
 *
 * @param name name of attribute
 * @return javadoc return line
 */
private static String getJavaDocReturnLine(String name) {
  return FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + getSmallCase(name)
      + NEW_LINE;
}

代码示例来源:origin: org.onosproject/onos-yang-serializers-utils

/**
 * Converts a resource identifier to URI string.
 *
 * @param rid     resource identifier
 * @param context YANG serializer context
 * @return URI
 */
public static String convertRidToUri(ResourceId rid,
                   YangSerializerContext context) {
  if (rid == null) {
    return null;
  }
  StringBuilder uriBuilder = new StringBuilder();
  List<NodeKey> nodeKeyList = rid.nodeKeys();
  String curNameSpace = null;
  for (NodeKey key : nodeKeyList) {
    curNameSpace = addNodeKeyToUri(key, curNameSpace, uriBuilder, context);
  }
  return trimAtLast(uriBuilder.toString(), SLASH);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns javadoc param line.
 *
 * @param name name of attribute
 * @return javadoc param line
 */
private static String getJavaDocParamLine(String name, String paraName) {
  return FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM +
      getSmallCase(paraName) + SPACE + VALUE + SPACE + OF + SPACE +
      getSmallCase(name) + NEW_LINE;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns class javadoc.
 *
 * @param name   name of class
 * @param type   type of javadoc
 * @param indent indentation
 * @return class javadoc
 */
private static String getJavaDocForClass(String name, String type,
                     String indent) {
  return NEW_LINE + indent + JAVA_DOC_FIRST_LINE + indent + type +
      getSmallCase(name) + PERIOD + NEW_LINE + indent + JAVA_DOC_END_LINE;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns class javadoc.
 *
 * @param name              name of class
 * @param type              type of javadoc
 * @param indent            indentation
 * @param isForDefaultClass if javadoc is generated for default class
 * @return class javadoc
 */
private static String getJavaDocForDefaultClass(String name, String type,
                        String indent, boolean isForDefaultClass) {
  String append = addFlagJavaDoc();
  if (!isForDefaultClass) {
    append = EMPTY_STRING;
  }
  return NEW_LINE + indent + JAVA_DOC_FIRST_LINE + indent + type +
      getSmallCase(name) + PERIOD + NEW_LINE + indent + append +
      JAVA_DOC_END_LINE;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Generates javaDocs for rpc method.
 *
 * @param rpcName    name of the rpc
 * @param inputName  name of input
 * @param outputName name of output
 * @return javaDocs of rpc method
 */
public static String generateJavaDocForRpc(String rpcName, String inputName,
                      String outputName) {
  String javadoc = getJavaDocStartLine(rpcName, JAVA_DOC_RPC) +
      getJavaDocEmptyAsteriskLine();
  if (!inputName.equals(EMPTY_STRING)) {
    javadoc = javadoc + getInputString(inputName, rpcName);
  }
  if (!outputName.equals(VOID)) {
    javadoc = javadoc + getOutputString(getSmallCase(outputName),
                      rpcName);
  }
  return javadoc + getJavaDocEndLine();
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Generates javaDocs for type constructor.
 *
 * @param attribute attribute string
 * @return javaDocs for type constructor
 */
public static String generateForGetMethodWithAttribute(String attribute) {
  attribute = getSmallCase(attribute);
  return getJavaDocStartLine(attribute, JAVA_DOC_GETTERS) +
      getJavaDocEmptyAsteriskLine() +
      getJavaDocParamLine(attribute, attribute) +
      getJavaDocReturnLine(attribute) +
      getJavaDocEndLine();
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

String compilerAnnotation) {
name = getSmallCase(name);
switch (type) {
  case DEFAULT_CLASS: {

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