本文整理了Java中org.onosproject.yangutils.datamodel.YangDataStructure
类的一些代码示例,展示了YangDataStructure
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangDataStructure
类的具体详情如下:
包路径:org.onosproject.yangutils.datamodel.YangDataStructure
类名称:YangDataStructure
[英]Represents ENUM to identify the YANG data type.
[中]表示用于标识数据类型的枚举。
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Returns YANG data structure type for corresponding data structure name.
*
* @param name data structure name from YANG file.
* @return YANG data structure for corresponding data structure name.
*/
public static YangDataStructure getDataStructureType(String name) {
name = name.replace("\"", "");
for (YangDataStructure dataStructure : values()) {
if (dataStructure.name().toLowerCase().equals(name.toLowerCase())) {
return dataStructure;
}
}
return null;
}
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
/**
* Performs validation and updates the data model tree. It is called when parser receives an
* input matching the grammar rule(app-data-structure).
*
* @param listener listener's object
* @param ctx context object of the grammar rule
*/
public static void processAppDataStructureEntry(TreeWalkListener listener,
GeneratedYangParser.AppDataStructureStatementContext ctx) {
checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", ENTRY);
String prefix = getValidPrefix(ctx.APP_DATA_STRUCTURE().getText(), APP_DATA_STRUCTURE, ctx);
YangDataStructure dataStructure = getDataStructureType(ctx.appDataStructure().getText());
YangAppDataStructure appDataStructure = new YangAppDataStructure();
appDataStructure.setPrefix(prefix);
appDataStructure.setDataStructure(dataStructure);
appDataStructure.setLineNumber(ctx.getStart().getLine());
appDataStructure.setCharPosition(ctx.getStart().getCharPositionInLine());
appDataStructure.setFileName(listener.getFileName());
Parsable curData = listener.getParsedDataStack().peek();
if (curData instanceof YangCompilerAnnotation) {
YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
compilerAnnotation.setYangAppDataStructure(appDataStructure);
listener.getParsedDataStack().push(appDataStructure);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_DATA_STRUCTURE,
"", ENTRY));
}
}
内容来源于网络,如有侵权,请联系作者删除!