本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition类的典型用法代码示例。如果您正苦于以下问题:Java LeafrefTypeDefinition类的具体用法?Java LeafrefTypeDefinition怎么用?Java LeafrefTypeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LeafrefTypeDefinition类属于org.opendaylight.yangtools.yang.model.api.type包,在下文中一共展示了LeafrefTypeDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeValue
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
/**
* Write a value into a XML stream writer. This method assumes the start and end of element is
* emitted by the caller.
*
* @param writer XML Stream writer
* @param schemaNode Schema node that describes the value
* @param value data value
* @param parent module QName owning the leaf definition
* @throws XMLStreamException if an encoding problem occurs
*/
void writeValue(@Nonnull final XMLStreamWriter writer, @Nonnull final SchemaNode schemaNode,
final Object value, final QNameModule parent) throws XMLStreamException {
if (value == null) {
LOG.debug("Value of {}:{} is null, not encoding it", schemaNode.getQName().getNamespace(),
schemaNode.getQName().getLocalName());
return;
}
checkArgument(schemaNode instanceof TypedDataSchemaNode,
"Unable to write value for node %s, only nodes of type: leaf and leaf-list can be written at this point",
schemaNode.getQName());
TypeDefinition<?> type = ((TypedDataSchemaNode) schemaNode).getType();
if (type instanceof LeafrefTypeDefinition) {
type = getBaseTypeForLeafRef(schemaNode, (LeafrefTypeDefinition) type);
}
writeValue(writer, type, value, parent);
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:30,代码来源:XMLStreamWriterUtils.java
示例2: findSchemaNodeWithLeafrefType
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private LeafSchemaNode findSchemaNodeWithLeafrefType(final DataNodeContainer module, final String nodeName) {
for (final DataSchemaNode childNode : module.getChildNodes()) {
if (childNode instanceof DataNodeContainer) {
LeafSchemaNode leafrefFromRecursion = findSchemaNodeWithLeafrefType((DataNodeContainer) childNode,
nodeName);
if (leafrefFromRecursion != null) {
return leafrefFromRecursion;
}
} else if (childNode.getQName().getLocalName().equals(nodeName) && childNode instanceof LeafSchemaNode) {
final TypeDefinition<?> leafSchemaNodeType = ((LeafSchemaNode) childNode).getType();
if (leafSchemaNodeType instanceof LeafrefTypeDefinition) {
return (LeafSchemaNode) childNode;
}
}
}
return null;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:XmlStreamUtilsTest.java
示例3: LeafrefTypeEffectiveStatementImpl
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
LeafrefTypeEffectiveStatementImpl(
final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx,
final LeafrefTypeDefinition baseType) {
super(ctx);
final RequireInstanceRestrictedTypeBuilder<LeafrefTypeDefinition> builder =
RestrictedTypes.newLeafrefBuilder(baseType, AbstractTypeStatementSupport.typeEffectiveSchemaPath(ctx));
for (final EffectiveStatement<?, ?> stmt : effectiveSubstatements()) {
if (stmt instanceof RequireInstanceEffectiveStatement) {
builder.setRequireInstance(((RequireInstanceEffectiveStatement) stmt).argument());
} else if (stmt instanceof UnknownSchemaNode) {
builder.addUnknownSchemaNode((UnknownSchemaNode)stmt);
}
}
typeDefinition = builder.build();
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:LeafrefTypeEffectiveStatementImpl.java
示例4: testLeafref
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
@Test
public void testLeafref() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-leafref"));
assertNotNull(currentLeaf.getType());
final LeafrefTypeDefinition leafrefEff = ((LeafrefSpecificationEffectiveStatement)
((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next())
.getTypeDefinition();
assertEquals("/container-test/leaf-test", leafrefEff.getPathStatement().toString());
assertNull(leafrefEff.getBaseType());
assertEquals(Optional.empty(), leafrefEff.getUnits());
assertEquals(Optional.empty(), leafrefEff.getDefaultValue());
assertNotNull(leafrefEff.toString());
assertEquals("leafref", leafrefEff.getQName().getLocalName());
assertEquals(Status.CURRENT, leafrefEff.getStatus());
assertNotNull(leafrefEff.getUnknownSchemaNodes());
assertEquals("leafref", leafrefEff.getPath().getLastComponent().getLocalName());
assertFalse(leafrefEff.getDescription().isPresent());
assertFalse(leafrefEff.getReference().isPresent());
assertNotNull(leafrefEff.hashCode());
assertFalse(leafrefEff.equals(null));
assertFalse(leafrefEff.equals("test"));
assertTrue(leafrefEff.equals(leafrefEff));
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:26,代码来源:EffectiveStatementTypeTest.java
示例5: getBaseTypeForLeafRef
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
/**
* Returns base type for {@code typeDefinition} which belongs to module specified via {@code qname}. This handle
* the case when leafref type isn't specified as type substatement of leaf or leaf-list but is defined in other
* module as typedef which is then imported to referenced module.
*
* <p>
* Because {@code typeDefinition} is definied via typedef statement, only absolute path is meaningful.
*/
public static TypeDefinition<?> getBaseTypeForLeafRef(final LeafrefTypeDefinition typeDefinition,
final SchemaContext schemaContext, final QName qname) {
final RevisionAwareXPath pathStatement = typeDefinition.getPathStatement();
final RevisionAwareXPath strippedPathStatement = new RevisionAwareXPathImpl(
stripConditionsFromXPathString(pathStatement), pathStatement.isAbsolute());
if (!strippedPathStatement.isAbsolute()) {
return null;
}
final Optional<Module> parentModule = schemaContext.findModule(qname.getModule());
Preconditions.checkArgument(parentModule.isPresent(), "Failed to find parent module for %s", qname);
final DataSchemaNode dataSchemaNode = (DataSchemaNode) SchemaContextUtil.findDataSchemaNode(schemaContext,
parentModule.get(), strippedPathStatement);
final TypeDefinition<?> targetTypeDefinition = typeDefinition(dataSchemaNode);
if (targetTypeDefinition instanceof LeafrefTypeDefinition) {
return getBaseTypeForLeafRef((LeafrefTypeDefinition) targetTypeDefinition, schemaContext, dataSchemaNode);
}
return targetTypeDefinition;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:30,代码来源:SchemaContextUtil.java
示例6: createComplexCodecFor
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private T createComplexCodecFor(final TypedDataSchemaNode schema, final TypeDefinition<?> type) {
if (type instanceof UnionTypeDefinition) {
return createComplexUnion(schema, (UnionTypeDefinition) type);
} else if (type instanceof LeafrefTypeDefinition) {
final TypeDefinition<?> target = SchemaContextUtil.getBaseTypeForLeafRef((LeafrefTypeDefinition) type,
schemaContext, schema);
verifyNotNull(target, "Unable to find base type for leafref node %s type %s.", schema.getPath(),
target);
final T ret = getSimpleCodecFor(target);
return ret != null ? ret : createComplexCodecFor(schema, target);
} else if (type instanceof IdentityrefTypeDefinition) {
return identityRefCodec((IdentityrefTypeDefinition) type, schema.getQName().getModule());
} else {
throw new IllegalArgumentException("Unsupported type " + type);
}
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:AbstractCodecFactory.java
示例7: addKeyValue
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
/**
* Adds a Key Value to the map for a specific uri value.
* @param map - current QName to Object mapping
* @param node - DataSchemaNode
* @param uriValue - uri value to add
* @throws Exception if error occurs during Uri decoding.
*/
private void addKeyValue(final HashMap<QName, Object> map, final DataSchemaNode node, final String uriValue)
throws Exception {
Preconditions.checkNotNull(uriValue);
Preconditions.checkArgument((node instanceof LeafSchemaNode));
final String urlDecoded = urlPathArgDecode(uriValue);
TypeDefinition<?> typedef = ((LeafSchemaNode) node).getType();
final TypeDefinition<?> baseType = resolveBaseTypeFrom(typedef);
if (baseType instanceof LeafrefTypeDefinition) {
typedef = SchemaContextUtil.getBaseTypeForLeafRef((LeafrefTypeDefinition) baseType, globalSchema, node);
}
Object decoded = deserialize(typedef, urlDecoded);
String additionalInfo = "";
if (decoded == null) {
if ((baseType instanceof IdentityrefTypeDefinition)) {
decoded = toQName(urlDecoded);
additionalInfo = "For key which is of type identityref it should be in format module_name:identity_name.";
}
}
if (decoded == null) {
throw new Exception(uriValue + " from URI can't be resolved. " + additionalInfo);
}
map.put(node.getQName(), decoded);
}
开发者ID:opendaylight,项目名称:fpc,代码行数:35,代码来源:NameResolver.java
示例8: emitTypeBodyNodes
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private void emitTypeBodyNodes(final TypeDefinition<?> typeDef) {
if (typeDef instanceof DecimalTypeDefinition) {
emitDecimal64Specification((DecimalTypeDefinition) typeDef);
} else if (typeDef instanceof RangeRestrictedTypeDefinition) {
emitRangeRestrictedSpecification((RangeRestrictedTypeDefinition<?, ?>) typeDef);
} else if (typeDef instanceof StringTypeDefinition) {
emitStringRestrictions((StringTypeDefinition) typeDef);
} else if (typeDef instanceof EnumTypeDefinition) {
emitEnumSpecification((EnumTypeDefinition) typeDef);
} else if (typeDef instanceof LeafrefTypeDefinition) {
emitLeafrefSpecification((LeafrefTypeDefinition) typeDef);
} else if (typeDef instanceof IdentityrefTypeDefinition) {
emitIdentityrefSpecification((IdentityrefTypeDefinition) typeDef);
} else if (typeDef instanceof InstanceIdentifierTypeDefinition) {
emitInstanceIdentifierSpecification((InstanceIdentifierTypeDefinition) typeDef);
} else if (typeDef instanceof BitsTypeDefinition) {
emitBitsSpecification((BitsTypeDefinition) typeDef);
} else if (typeDef instanceof UnionTypeDefinition) {
emitUnionSpecification((UnionTypeDefinition) typeDef);
} else if (typeDef instanceof BinaryTypeDefinition) {
((BinaryTypeDefinition) typeDef).getLengthConstraint().ifPresent(this::emitLength);
} else if (typeDef instanceof BooleanTypeDefinition || typeDef instanceof EmptyTypeDefinition) {
// NOOP
} else {
throw new IllegalArgumentException("Not supported type " + typeDef.getClass());
}
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:28,代码来源:SchemaContextEmitter.java
示例9: getBaseTypeModule
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private Module getBaseTypeModule(final LeafrefTypeDefinition leafrefType) {
/*
* Find the first definition of supplied leafref type and return the
* module which contains this definition.
*/
LeafrefTypeDefinition baseLeafRefType = leafrefType;
while (baseLeafRefType.getBaseType() != null) {
baseLeafRefType = baseLeafRefType.getBaseType();
}
return schemaContext.findModule(baseLeafRefType.getQName().getModule()).orElse(null);
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:12,代码来源:LeafRefContextTreeBuilder.java
示例10: getTargetNodeForLeafRef
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private TypeDefinition<?> getTargetNodeForLeafRef(final String nodeName, final Class<?> clas) {
final LeafSchemaNode schemaNode = findSchemaNodeWithLeafrefType(leafRefModule, nodeName);
assertNotNull(schemaNode);
final LeafrefTypeDefinition leafrefTypedef = findLeafrefType(schemaNode);
assertNotNull(leafrefTypedef);
final TypeDefinition<?> targetBaseType = SchemaContextUtil.getBaseTypeForLeafRef(leafrefTypedef, schemaContext,
schemaNode);
assertTrue("Wrong class found.", clas.isInstance(targetBaseType));
return targetBaseType;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:XmlStreamUtilsTest.java
示例11: findLeafrefType
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private static LeafrefTypeDefinition findLeafrefType(final LeafSchemaNode schemaNode) {
final TypeDefinition<?> type = schemaNode.getType();
if (type instanceof LeafrefTypeDefinition) {
return (LeafrefTypeDefinition) type;
}
return null;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:8,代码来源:XmlStreamUtilsTest.java
示例12: testRequireInstanceInLeafrefs
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
@Test
public void testRequireInstanceInLeafrefs() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/leafref-stmt/foo.yang");
assertNotNull(schemaContext);
final Module foo = schemaContext.findModule("foo", Revision.of("2016-12-20")).get();
final Set<TypeDefinition<?>> typeDefinitions = foo.getTypeDefinitions();
assertEquals(1, typeDefinitions.size());
final TypeDefinition<?> typeDefinition = typeDefinitions.iterator().next();
final LeafrefTypeDefinition leafrefTypeDefinition = (LeafrefTypeDefinition) typeDefinition;
assertTrue(leafrefTypeDefinition.requireInstance());
final LeafSchemaNode leafrefA = (LeafSchemaNode) foo.getDataChildByName(QName.create(foo.getQNameModule(),
"leafref-a"));
assertNotNull(leafrefA);
assertRequireInstanceInLeafref(leafrefA, true);
final LeafSchemaNode leafrefB = (LeafSchemaNode) foo.getDataChildByName(QName.create(foo.getQNameModule(),
"leafref-b"));
assertNotNull(leafrefB);
assertRequireInstanceInLeafref(leafrefB, true);
final LeafSchemaNode leafrefC = (LeafSchemaNode) foo.getDataChildByName(QName.create(foo.getQNameModule(),
"leafref-c"));
assertNotNull(leafrefC);
assertRequireInstanceInLeafref(leafrefC, false);
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:29,代码来源:LeafrefStatementTest.java
示例13: test
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
@Test
public void test() throws Exception {
SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug5437");
assertNotNull(context);
QName root = QName.create(NS, REV, "root");
QName leafRef2 = QName.create(NS, REV, "leaf-ref-2");
QName conGrp = QName.create(NS, REV, "con-grp");
QName leafRef = QName.create(NS, REV, "leaf-ref");
SchemaPath leafRefPath = SchemaPath.create(true, root, conGrp, leafRef);
SchemaPath leafRef2Path = SchemaPath.create(true, root, leafRef2);
SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context, leafRefPath);
SchemaNode findDataSchemaNode2 = SchemaContextUtil.findDataSchemaNode(context, leafRef2Path);
assertTrue(findDataSchemaNode instanceof LeafSchemaNode);
assertTrue(findDataSchemaNode2 instanceof LeafSchemaNode);
LeafSchemaNode leafRefNode = (LeafSchemaNode) findDataSchemaNode;
LeafSchemaNode leafRefNode2 = (LeafSchemaNode) findDataSchemaNode2;
assertTrue(leafRefNode.getType() instanceof LeafrefTypeDefinition);
assertTrue(leafRefNode2.getType() instanceof LeafrefTypeDefinition);
TypeDefinition<?> baseTypeForLeafRef = SchemaContextUtil.getBaseTypeForLeafRef(
(LeafrefTypeDefinition) leafRefNode.getType(), context, leafRefNode);
TypeDefinition<?> baseTypeForLeafRef2 = SchemaContextUtil.getBaseTypeForLeafRef(
(LeafrefTypeDefinition) leafRefNode2.getType(), context, leafRefNode2);
assertTrue(baseTypeForLeafRef instanceof BinaryTypeDefinition);
assertTrue(baseTypeForLeafRef2 instanceof Int16TypeDefinition);
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:31,代码来源:Bug5437Test.java
示例14: derivedLeafrefBuilder
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
public static DerivedTypeBuilder<LeafrefTypeDefinition> derivedLeafrefBuilder(final LeafrefTypeDefinition baseType,
final SchemaPath path) {
return new DerivedTypeBuilder<LeafrefTypeDefinition>(baseType, path) {
@Override
public LeafrefTypeDefinition build() {
return new DerivedLeafrefType(getBaseType(), getPath(), getDefaultValue(), getDescription(),
getReference(), getStatus(), getUnits(), getUnknownSchemaNodes());
}
};
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:DerivedTypes.java
示例15: newLeafrefBuilder
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
public static RequireInstanceRestrictedTypeBuilder<LeafrefTypeDefinition> newLeafrefBuilder(
final LeafrefTypeDefinition baseType, final SchemaPath path) {
return new RequireInstanceRestrictedTypeBuilder<LeafrefTypeDefinition>(baseType, path) {
@Override
LeafrefTypeDefinition buildType() {
if (getRequireInstance() == getBaseType().requireInstance()) {
return getBaseType();
}
return new RestrictedLeafrefType(getBaseType(), getPath(), getUnknownSchemaNodes(),
getRequireInstance());
}
};
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:14,代码来源:RestrictedTypes.java
示例16: concreteLeafrefBuilder
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private static ConcreteTypeBuilder<LeafrefTypeDefinition> concreteLeafrefBuilder(
final LeafrefTypeDefinition baseType, final SchemaPath path) {
return new ConcreteTypeBuilder<LeafrefTypeDefinition>(baseType, path) {
@Nonnull
@Override
public LeafrefTypeDefinition buildType() {
return new DerivedLeafrefType(getBaseType(), getPath(), getDefaultValue(), getDescription(),
getReference(), getStatus(), getUnits(), getUnknownSchemaNodes());
}
};
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:12,代码来源:ConcreteTypes.java
示例17: testMethodsOfLeafrefTest
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
@Test
public void testMethodsOfLeafrefTest() {
final SchemaPath schemaPath = SchemaPath.create(false, QName.create("test", "Cont1"),
QName.create("test", "List1"));
final RevisionAwareXPathImpl revision = new RevisionAwareXPathImpl("/test:Cont1/test:List1", false);
final RevisionAwareXPathImpl revision2 = new RevisionAwareXPathImpl("/test:Cont1/test:List2", false);
final LeafrefTypeDefinition leafref = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision)
.build();
final LeafrefTypeDefinition leafref2 = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision2)
.build();
final LeafrefTypeDefinition leafref3 = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision)
.build();
final LeafrefTypeDefinition leafref4 = leafref;
assertNotNull("Object 'leafref' shouldn't be null.", leafref);
assertNull("Base type of 'leafref' should be null.", leafref.getBaseType());
assertEquals(Optional.empty(), leafref.getUnits());
assertEquals(Optional.empty(), leafref.getDefaultValue());
assertEquals(QName.create("test", "List1"), leafref.getQName());
assertEquals("SchemaPath of 'leafref' is '/Cont1/List1'.", schemaPath, leafref.getPath());
assertFalse(leafref.getDescription().isPresent());
assertFalse(leafref.getReference().isPresent());
assertEquals("Status of 'leafref' is current.", Status.CURRENT, leafref.getStatus());
assertTrue("Object 'leafref' shouldn't have any unknown schema nodes.",
leafref.getUnknownSchemaNodes().isEmpty());
assertEquals("Revision aware XPath of 'leafref' should be '/test:Cont1/test:List1'.", revision,
leafref.getPathStatement());
assertNotNull("String representation of 'leafref' shouldn't be null.", leafref.toString());
assertNotEquals("Hash codes of two different object of type Leafref shouldn't be equal.", leafref.hashCode(),
leafref2.hashCode());
assertTrue("Objects of type Leafref should be equal.", leafref.equals(leafref3));
assertTrue("Objects of type Leafref should be equal.", leafref.equals(leafref4));
assertFalse("Objects of type Leafref shouldn't be equal.", leafref.equals(leafref2));
assertFalse("Objects shouldn't be equal.", leafref.equals(null));
assertFalse("Objects shouldn't be equal.", leafref.equals("test"));
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:38,代码来源:LeafrefTest.java
示例18: testRequireInstanceSubstatement
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
@Test
public void testRequireInstanceSubstatement() {
final SchemaPath schemaPath = SchemaPath.create(true, QName.create("test", "my-cont"),
QName.create("test", "my-leafref"));
final RevisionAwareXPathImpl path = new RevisionAwareXPathImpl("../my-leaf", false);
LeafrefTypeBuilder leafrefTypeBuilder = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(path);
leafrefTypeBuilder.setRequireInstance(false);
LeafrefTypeDefinition leafref = leafrefTypeBuilder.build();
assertFalse(leafref.requireInstance());
leafrefTypeBuilder.setRequireInstance(true);
leafref = leafrefTypeBuilder.build();
assertTrue(leafref.requireInstance());
leafrefTypeBuilder.setRequireInstance(true);
leafref = leafrefTypeBuilder.build();
assertTrue(leafref.requireInstance());
try {
leafrefTypeBuilder.setRequireInstance(false);
fail("An IllegalArgumentException should have been thrown.");
} catch (IllegalArgumentException ex) {
assertEquals(
"Cannot switch off require-instance in type AbsoluteSchemaPath{path=[(test)my-cont, (test)my-leafref]}",
ex.getMessage());
}
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:31,代码来源:LeafrefTest.java
示例19: isSimpleUnion
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
private static boolean isSimpleUnion(final UnionTypeDefinition union) {
for (TypeDefinition<?> t : union.getTypes()) {
if (t instanceof IdentityrefTypeDefinition || t instanceof LeafrefTypeDefinition
|| t instanceof UnionTypeDefinition && !isSimpleUnion((UnionTypeDefinition) t)) {
LOG.debug("Type {} has non-simple subtype", t);
return false;
}
}
LOG.debug("Type {} is simple", union);
return true;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:13,代码来源:AbstractCodecFactory.java
示例20: generatedTypeForExtendedDefinitionType
import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; //导入依赖的package包/类
public Type generatedTypeForExtendedDefinitionType(final TypeDefinition<?> typeDefinition) {
Type returnType = null;
if (typeDefinition == null) {
throw new IllegalArgumentException("Type Definition cannot be NULL!");
}
if (typeDefinition.getQName() == null) {
throw new IllegalArgumentException(
"Type Definition cannot have non specified QName (QName cannot be NULL!)");
}
if (typeDefinition.getQName() == null) {
throw new IllegalArgumentException("Type Definitions Local Name cannot be NULL!");
}
final String typedefName = typeDefinition.getQName().getLocalName();
if (typeDefinition instanceof ExtendedType) {
final TypeDefinition<?> baseTypeDef = baseTypeDefForExtendedType(typeDefinition);
if (!(baseTypeDef instanceof LeafrefTypeDefinition) && !(baseTypeDef instanceof IdentityrefTypeDefinition)) {
final Module module = findParentModuleForTypeDefinition(schemaContext, typeDefinition);
if (module != null) {
final Map<String, Type> genTOs = genTypeDefsContextMap.get(module.getName());
if (genTOs != null) {
returnType = genTOs.get(typedefName);
}
}
}
}
return returnType;
}
开发者ID:lbchen,项目名称:ODL,代码行数:31,代码来源:TypeProviderImpl.java
注:本文中的org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论