本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition类的典型用法代码示例。如果您正苦于以下问题:Java BooleanTypeDefinition类的具体用法?Java BooleanTypeDefinition怎么用?Java BooleanTypeDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BooleanTypeDefinition类属于org.opendaylight.yangtools.yang.model.api.type包,在下文中一共展示了BooleanTypeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBoolean
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
@Test
public void testBoolean() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-boolean"));
assertNotNull(currentLeaf.getType());
final BooleanTypeDefinition booleanEff = (BooleanTypeDefinition) ((TypeEffectiveStatement<?>)
((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next())
.getTypeDefinition();
assertNull(booleanEff.getBaseType());
assertEquals(Optional.empty(), booleanEff.getUnits());
assertEquals(Optional.empty(), booleanEff.getDefaultValue());
assertEquals("boolean", booleanEff.getQName().getLocalName());
assertNull(booleanEff.getPath().getParent().getParent());
assertNotNull(booleanEff.getUnknownSchemaNodes());
assertFalse(booleanEff.getDescription().isPresent());
assertFalse(booleanEff.getReference().isPresent());
assertEquals(Status.CURRENT, booleanEff.getStatus());
assertNotNull(booleanEff.toString());
}
示例2: canCreateBooleanType
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
@Test
public void canCreateBooleanType() {
final BooleanTypeDefinition boolType = booleanType();
final String stringBoolType = boolType.toString();
assertEquals("getPath gives List of BOOLEAN_QNAME",
Collections.singletonList(BaseTypes.BOOLEAN_QNAME), boolType.getPath().getPathFromRoot());
assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
assertFalse(boolType.getDescription().isPresent());
final String strPath = boolType.getPath().toString();
assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
assertEquals(Optional.empty(), boolType.getUnits());
assertEquals("Base type is null", null, boolType.getBaseType());
assertEquals(Optional.empty(), boolType.getDefaultValue());
assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());
}
示例3: emitTypeBodyNodes
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的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());
}
}
示例4: fromType
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
public static TypeDefinitionAwareCodec<?, ?> fromType(final TypeDefinition<?> typeDefinition) {
final TypeDefinitionAwareCodec<?, ?> codec;
if (typeDefinition instanceof BinaryTypeDefinition) {
codec = BinaryStringCodec.from((BinaryTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof BitsTypeDefinition) {
codec = BitsStringCodec.from((BitsTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof BooleanTypeDefinition) {
codec = BooleanStringCodec.from((BooleanTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof DecimalTypeDefinition) {
codec = DecimalStringCodec.from((DecimalTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof EmptyTypeDefinition) {
codec = EmptyStringCodec.INSTANCE;
} else if (typeDefinition instanceof EnumTypeDefinition) {
codec = EnumStringCodec.from((EnumTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof Int8TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Int8TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Int16TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Int16TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Int32TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Int32TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Int64TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Int64TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof StringTypeDefinition) {
codec = StringStringCodec.from((StringTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof UnionTypeDefinition) {
codec = UnionStringCodec.from((UnionTypeDefinition)typeDefinition);
} else if (typeDefinition instanceof Uint8TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Uint8TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Uint16TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Uint16TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Uint32TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Uint32TypeDefinition) typeDefinition);
} else if (typeDefinition instanceof Uint64TypeDefinition) {
codec = AbstractIntegerStringCodec.from((Uint64TypeDefinition) typeDefinition);
} else {
codec = null;
}
return codec;
}
示例5: derivedBooleanBuilder
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
public static DerivedTypeBuilder<BooleanTypeDefinition> derivedBooleanBuilder(
@Nonnull final BooleanTypeDefinition baseType, @Nonnull final SchemaPath path) {
return new DerivedTypeBuilder<BooleanTypeDefinition>(baseType, path) {
@Override
public BooleanTypeDefinition build() {
return new DerivedBooleanType(getBaseType(), getPath(), getDefaultValue(), getDescription(),
getReference(), getStatus(), getUnits(), getUnknownSchemaNodes());
}
};
}
示例6: newBooleanBuilder
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
public static TypeBuilder<BooleanTypeDefinition> newBooleanBuilder(@Nonnull final BooleanTypeDefinition baseType,
@Nonnull final SchemaPath path) {
return new AbstractRestrictedTypeBuilder<BooleanTypeDefinition>(baseType, path) {
@Override
BooleanTypeDefinition buildType() {
return new RestrictedBooleanType(getBaseType(), getPath(), getUnknownSchemaNodes());
}
};
}
示例7: concreteBooleanBuilder
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
private static ConcreteTypeBuilder<BooleanTypeDefinition> concreteBooleanBuilder(
@Nonnull final BooleanTypeDefinition baseType, @Nonnull final SchemaPath path) {
return new ConcreteTypeBuilder<BooleanTypeDefinition>(baseType, path) {
@Nonnull
@Override
public BooleanTypeDefinition buildType() {
return new DerivedBooleanType(getBaseType(), getPath(), getDefaultValue(), getDescription(),
getReference(), getStatus(), getUnits(), getUnknownSchemaNodes());
}
};
}
示例8: forSchema
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
/**
* Return a {@link LeafInterner} for a particular schema. Interner instances must not be reused for leaves of
* different types, otherwise they may produce unexpected results.
*
* @param schema The leaf node's schema
* @return An interner instance
*/
@Nonnull public static <T extends LeafNode<?>> Interner<T> forSchema(@Nullable final LeafSchemaNode schema) {
if (schema != null) {
final TypeDefinition<?> type = schema.getType();
if (type instanceof BooleanTypeDefinition || type instanceof EnumTypeDefinition
|| type instanceof IdentityrefTypeDefinition) {
return LeafInterner::intern;
}
}
return Objects::requireNonNull;
}
示例9: forSchema
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
/**
* Return a {@link LeafsetEntryInterner} for a particular schema. Interner instances must be used only for leafset
* entries for that particular schema, otherwise they may produce unexpected results.
*
* @param schema Schema of the parent leaf set
* @return An interner instance, or null if the leafset's type should not be interned.
*/
@Nullable public static LeafsetEntryInterner forSchema(@Nullable final LeafListSchemaNode schema) {
if (schema != null) {
final TypeDefinition<?> type = schema.getType();
if (type instanceof BooleanTypeDefinition || type instanceof EnumTypeDefinition
|| type instanceof IdentityrefTypeDefinition) {
return INSTANCE;
}
}
return null;
}
示例10: booleanCodec
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
@Override
protected JSONCodec<?> booleanCodec(final BooleanTypeDefinition type) {
return new BooleanJSONCodec(BooleanStringCodec.from(type));
}
示例11: BooleanStringCodec
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
private BooleanStringCodec(final Optional<BooleanTypeDefinition> typeDef) {
super(typeDef, Boolean.class);
}
示例12: from
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
public static BooleanStringCodec from(final BooleanTypeDefinition normalizedType) {
return new BooleanStringCodec(Optional.of(normalizedType));
}
示例13: booleanCodec
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
@Override
protected XmlCodec<?> booleanCodec(final BooleanTypeDefinition type) {
return new BooleanXmlCodec(BooleanStringCodec.from(type));
}
示例14: BooleanTypeEffectiveStatementImpl
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
BooleanTypeEffectiveStatementImpl(
final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx,
final BooleanTypeDefinition baseType) {
super(ctx, RestrictedTypes.newBooleanBuilder(baseType,
AbstractTypeStatementSupport.typeEffectiveSchemaPath(ctx)));
}
示例15: DerivedBooleanType
import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; //导入依赖的package包/类
DerivedBooleanType(final BooleanTypeDefinition baseType, final SchemaPath path, final Object defaultValue,
final String description, final String reference, final Status status, final String units,
final Collection<UnknownSchemaNode> unknownSchemNodes) {
super(baseType, path, defaultValue, description, reference, status, units, unknownSchemNodes);
}