- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.onosproject.yangutils.datamodel.YangType
类的一些代码示例,展示了YangType
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangType
类的具体详情如下:
包路径:org.onosproject.yangutils.datamodel.YangType
类名称:YangType
[英]Represents the data type information.
[中]表示数据类型信息。
代码示例来源:origin: org.onosproject/onos-yang-datamodel
while (potentialTypeNode != null) {
String dataTypeName = null;
if (dataType.getDataType() == YangDataTypes.ENUMERATION) {
YangEnumeration enumNode = (YangEnumeration) dataType.getDataTypeExtendedInfo();
dataTypeName = enumNode.getName();
} else if (dataType.getDataType() == YangDataTypes.UNION) {
YangUnion unionNode = (YangUnion) dataType.getDataTypeExtendedInfo();
dataTypeName = unionNode.getName();
dataType.setDataTypeExtendedInfo(potentialTypeNode);
return;
dataType.getDataTypeName() + " in " +
dataType.getLineNumber() + " at " +
dataType.getCharPosition() +
" in " + dataType.getFileName() + "\"");
代码示例来源:origin: org.onosproject/onos-yang-datamodel
@Override
public Object resolve()
throws DataModelException {
/*
* Check whether the data type is derived.
*/
if (getDataType() != DERIVED) {
throw new DataModelException("Linker Error: Resolve should only be called for derived data types. "
+ " in " +
getLineNumber() + " at " +
getCharPosition()
+ " in " + getFileName() + "\"");
}
// Check if the derived info is present.
YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
if (derivedInfo == null) {
throw new DataModelException("Linker Error: Derived information is missing. " + " in " +
getLineNumber() + " at " +
getCharPosition()
+ " in " + getFileName() + "\"");
}
// Initiate the resolution
try {
setResolvableStatus(derivedInfo.resolve());
} catch (DataModelException e) {
throw new DataModelException(e.getMessage());
}
return null;
}
代码示例来源:origin: org.onosproject/onos-yang-datamodel
if (currentListOfLeaves != null) {
for (YangLeaf leaf : currentListOfLeaves) {
if (leaf.getDataType().getDataType() == YangDataTypes.ENUMERATION
|| leaf.getDataType().getDataType() == YangDataTypes.UNION) {
try {
YangType<?> clonedType = leaf.getDataType().clone();
updateClonedTypeRef(clonedType, leavesHolder);
leaf.setDataType(clonedType);
e.printStackTrace();
throw new DataModelException("Could not clone Type node " +
leaf.getDataType().getDataTypeName() + " in " +
leaf.getDataType().getLineNumber() + " at " +
leaf.getDataType().getCharPosition() +
" in " + leaf.getDataType().getFileName() + "\"");
if (currentListOfLeafList != null) {
for (YangLeafList leafList : currentListOfLeafList) {
if (leafList.getDataType().getDataType() == YangDataTypes.ENUMERATION
|| leafList.getDataType().getDataType() == YangDataTypes.UNION) {
try {
YangType<?> clonedType = leafList.getDataType().clone();
updateClonedTypeRef(clonedType, leavesHolder);
leafList.setDataType(clonedType);
e.printStackTrace();
throw new DataModelException("Could not clone Type node " +
leafList.getDataType().getDataTypeName() + " in " +
leafList.getDataType().getLineNumber() + " at " +
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
/**
* Sets the default require instance value as true when the type is instance identifier.
*
* @param type type to which the value has to be set
*/
private static void setDefaultRequireInstanceForInstanceIdentifier(YangType<?> type) {
if (type.getDataType() == YangDataTypes.INSTANCE_IDENTIFIER) {
((YangType<Boolean>) type).setDataTypeExtendedInfo(true);
}
}
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Returns resolvable entity when the type is derived. It sets needed
* information to entity such as line number,position number and holder.
* Returns null when identity is for inter grouping.
*
* @param type derived YANG type
* @param holder holder node
* @param isLeaf leaf or leaf-list
* @return entity to resolve for derived type
*/
private static YangEntityToResolveInfoImpl getDerivedResolvableEntity(
YangType<?> type, YangNode holder, boolean isLeaf) {
YangEntityToResolveInfoImpl<YangType<?>> derivedInfo =
new YangEntityToResolveInfoImpl<>();
if (type.isTypeForInterFileGroupingResolution()) {
return null;
}
if (!isLeaf && type.isTypeNotResolvedTillRootNode()) {
return null;
}
derivedInfo.setEntityToResolve(type);
return setInformationInEntity(
derivedInfo, holder, type.getCharPosition(),
type.getLineNumber());
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
if (type.getDataType() == DERIVED) {
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setRangeRestrictionString(ctx.range().getText());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setLineNumber(ctx.getStart().getLine());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setCharPosition(ctx.getStart().getCharPositionInLine());
return;
if (!(isOfRangeRestrictedType(type.getDataType())) && (type.getDataType() != DECIMAL64)) {
ParserException parserException = new ParserException("YANG file error: Range restriction can't be " +
"applied to a given type");
if (type.getDataType() == DECIMAL64) {
YangDecimal64 yangDecimal64 = (YangDecimal64) type.getDataTypeExtendedInfo();
rangeRestriction =
processRangeRestriction(yangDecimal64.getDefaultRangeRestriction(),
ctx.getStart().getCharPositionInLine(),
true, ctx.range().getText(),
type.getDataType(), listener.getFileName());
} else {
rangeRestriction =
false, ctx.range()
.getText(), type
.getDataType(),
listener.getFileName());
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
type.setNodeId(nodeIdentifier);
type.setDataType(yangDataTypes);
type.setLineNumber(ctx.getStart().getLine());
type.setCharPosition(ctx.getStart().getCharPositionInLine());
type.setFileName(listener.getFileName());
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
type.setResolvableStatus(UNRESOLVED);
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
type.setResolvableStatus(UNRESOLVED);
yangDerivedInfo.setCharPosition(ctx.getStart().getCharPositionInLine());
yangDerivedInfo.setFileName(listener.getFileName());
((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
type.setResolvableStatus(UNRESOLVED);
代码示例来源:origin: org.onosproject/onos-yang-datamodel
switch (getDataType()) {
case INT8:
case INT16:
case UINT32:
case UINT64: {
if (getDataTypeExtendedInfo() == null) {
getDataObjectFromString(value, getDataType());
} else {
if (!((YangRangeRestriction) getDataTypeExtendedInfo()).isValidValueString(value)) {
throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
getDataType());
(YangDecimal64<YangRangeRestriction>) getDataTypeExtendedInfo();
validateDecimal64(value, decimal64.getFractionDigit(),
decimal64.getRangeRestrictedExtendedInfo());
break;
if (getDataTypeExtendedInfo() == null) {
break;
} else if (!(((YangStringRestriction) getDataTypeExtendedInfo()).isValidStringOnLengthRestriction(value)
&& ((YangStringRestriction) getDataTypeExtendedInfo())
.isValidStringOnPatternRestriction(value))) {
throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
getDataType());
if (!(value.equals(DataModelUtils.TRUE) || value.equals(DataModelUtils.FALSE))) {
throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
getDataType());
代码示例来源:origin: org.onosproject/onos-yang-datamodel
switch (dataType.getDataType()) {
case DERIVED:
return ((YangDerivedInfo) dataType.getDataTypeExtendedInfo())
.getEffectiveBuiltInType().equals(EMPTY);
.getDataTypeExtendedInfo())
.getEffectiveDataType();
if (type.getDataType() == YangDataTypes.DERIVED) {
return ((YangDerivedInfo) type.getDataTypeExtendedInfo())
.getEffectiveBuiltInType().equals(EMPTY);
return ((YangLeafRef) dataType.getDataTypeExtendedInfo())
.getEffectiveDataType().getDataType().equals(EMPTY);
return ((YangUnion) dataType.getDataTypeExtendedInfo())
.getTypeList().contains(EMPTY);
default:
return dataType.getDataType().equals(EMPTY);
代码示例来源:origin: org.onosproject/onos-yang-datamodel
YangType baseType = yangLeaf.getDataType();
if (baseType.getDataType() == LEAFREF) {
YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
} else if (baseType.getDataType() == YangDataTypes.DERIVED) {
if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED
&& baseType.getResolvableStatus() != RESOLVED) {
throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
" in " +
if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
return INTRA_FILE_RESOLVED;
if (baseType.getDataType() == LEAFREF) {
YangLeafRef referredLeafRefInfo = (YangLeafRef) yangLeafList.getDataType().getDataTypeExtendedInfo();
} else if (baseType.getDataType() == YangDataTypes.DERIVED) {
if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED
&& baseType.getResolvableStatus() != RESOLVED) {
throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
" in " +
if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
return INTRA_FILE_RESOLVED;
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Returns types that has to be resolved for a single leaf/leaf-list.
* Identifies the object to be leaf/leaf-list and assigns respective
* parameters to resolve the types under leaf/leaf-list.
*
* @param clonedObj leaf/leaf-list object
* @param holderNode holder node
* @param yangUses YANG uses
* @return list of resolvable entities in a leaf/leaf-list
* @throws DataModelException data model error
*/
private static List<YangEntityToResolveInfoImpl> getTypesToBeResolved(
Object clonedObj, YangNode holderNode,
YangUses yangUses) throws DataModelException {
YangType type;
if (clonedObj instanceof YangLeaf) {
YangLeaf clonedLeaf = (YangLeaf) clonedObj;
type = clonedLeaf.getDataType();
return getUnresolvedTypeList(type.getDataType(), type, holderNode,
yangUses, true);
}
YangLeafList clonedLeafList = (YangLeafList) clonedObj;
type = clonedLeafList.getDataType();
return getUnresolvedTypeList(type.getDataType(), type, holderNode,
yangUses, false);
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
case TYPE_DATA: {
YangType<YangBits> typeNode = (YangType<YangBits>) tmpNode;
typeNode.setDataTypeExtendedInfo(bitsNode);
break;
代码示例来源:origin: org.onosproject/onos-yang-datamodel
while (rangeListIterator.hasNext()) {
YangRangeInterval rangeInterval = rangeListIterator.next();
rangeInterval.setFileName(getFileName());
rangeInterval.setLineNumber(getLineNumber());
rangeInterval.setCharPosition(getCharPosition());
BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
/**
* Performs validation and updates the data model tree.
* It is called when parser exits from grammar rule (decimal64).
*
* @param listener listener's object
* @param ctx context object of the grammar rule
*/
public static void processDecimal64Exit(TreeWalkListener listener,
GeneratedYangParser.Decimal64SpecificationContext ctx) {
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
if (tmpNode instanceof YangType) {
YangType<YangDecimal64<YangRangeRestriction>> typeNode =
(YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
YangDecimal64<YangRangeRestriction> decimal64Node = typeNode.getDataTypeExtendedInfo();
try {
decimal64Node.validateRange();
} catch (DataModelException e) {
throw new ParserException(e);
}
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", EXIT));
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
((YangType<?>) typeData).getDataTypeName(), ENTRY));
代码示例来源:origin: org.onosproject/onos-yang-datamodel
if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED &&
baseType.getResolvableStatus() != RESOLVED) {
throwError();
.getResolvableStatus() == INTRA_FILE_RESOLVED) {
return INTRA_FILE_RESOLVED;
.getDataTypeExtendedInfo()).getEffectiveBuiltInType();
YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
T extendedInfo = (T) refDerivedInfo.getResolvedExtendedInfo();
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
GeneratedYangParser.PatternStatementContext ctx) {
if (type.getDataType() != YangDataTypes.STRING && type.getDataType() != YangDataTypes.DERIVED) {
if (type.getDataType() == YangDataTypes.STRING) {
YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
if (stringRestriction == null) {
stringRestriction = new YangStringRestriction();
stringRestriction.setCharPosition(ctx.getStart().getCharPositionInLine());
stringRestriction.setLineNumber(ctx.getStart().getLine());
type.setDataTypeExtendedInfo(stringRestriction);
stringRestriction.addPattern(patternArgument);
} else {
} else {
YangPatternRestriction patternRestriction = ((YangDerivedInfo<?>) type
.getDataTypeExtendedInfo()).getPatternRestriction();
if (patternRestriction == null) {
patternRestriction = new YangPatternRestriction();
((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
patternRestriction.addPattern(patternArgument);
} else {
((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
patternRestriction.addPattern(patternArgument);
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Returns resolvable entity under union. When types under union have
* identity-ref, derived and union, the function call is done recursively
* to get resolvable entity and adds it to list.
*
* @param type union YANG type
* @param isLeaf leaf or leaf-list
* @return resolvable entity list after setting info
* @throws DataModelException data model error
*/
private static List<YangEntityToResolveInfoImpl> getUnionResolvableEntity(
YangType type, boolean isLeaf) throws DataModelException {
YangUnion union = (YangUnion) type.getDataTypeExtendedInfo();
List<YangType<?>> typeList = union.getTypeList();
List<YangEntityToResolveInfoImpl> unionList = new ArrayList<>();
List<YangEntityToResolveInfoImpl> entity;
for (YangType unionType : typeList) {
entity = getUnresolvedTypeList(unionType.getDataType(),
unionType, union, null, isLeaf);
if (nonEmpty(entity)) {
unionList.addAll(entity);
}
}
return unionList;
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
if (((YangType) curData).getDataType() == YangDataTypes.INSTANCE_IDENTIFIER) {
((YangType) curData).setDataTypeExtendedInfo(isRequireInstance);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REQUIRE_INSTANCE_DATA,
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Adds YANG type to type list.
*
* @param yangType YANG type to be added to list
* @throws DataModelException union member type must not be one of the
* built-in types "empty" or "leafref"
*/
public void addType(YangType<?> yangType)
throws DataModelException {
YangDataTypes type = yangType.getDataType();
String msg = "Union member type must not be one of the built-in types" +
" \"empty\" or \"leafref\"";
switch (type) {
case EMPTY:
case LEAFREF:
throw new DataModelException(getErrorMsg(
msg, getName(), getLineNumber(), getCharPosition(),
getFileName()));
default:
typeList.add(yangType);
}
}
本文整理了Java中org.onosproject.yangutils.datamodel.YangType.setResolvableStatus()方法的一些代码示例,展示了YangType.se
本文整理了Java中org.onosproject.yangutils.datamodel.YangType.setDataTypeExtendedInfo()方法的一些代码示例,展示了YangTyp
本文整理了Java中org.onosproject.yangutils.datamodel.YangType.getDataTypeName()方法的一些代码示例,展示了YangType.getDat
本文整理了Java中org.onosproject.yangutils.datamodel.YangType.getDataTypeExtendedInfo()方法的一些代码示例,展示了YangTyp
本文整理了Java中org.onosproject.yangutils.datamodel.YangType.getDataType()方法的一些代码示例,展示了YangType.getDataTyp
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.setDataType()方法的一些代码示例,展示了YangType.setDat
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.getLineNumber()方法的一些代码示例,展示了YangType.getL
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.getCharPosition()方法的一些代码示例,展示了YangType.ge
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.getDataTypeName()方法的一些代码示例,展示了YangType.ge
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.getDataTypeExtendedInfo()方法的一些代码示例,展示了Yan
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.setResolvableStatus()方法的一些代码示例,展示了YangTyp
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.getDataType()方法的一些代码示例,展示了YangType.getDat
本文整理了Java中org.onosproject.yang.compiler.datamodel.YangType.setDataTypeExtendedInfo()方法的一些代码示例,展示了Yan
我是一名优秀的程序员,十分优秀!