2 * Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.util.type;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
12 import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
13 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
14 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
15 import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
16 import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
17 import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
18 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
21 * Utility access methods for creating and accessing YANG base type definitions. YANG types come in two basic variants,
22 * depending on whether they fully define their base instance or model input is required to fully-form the type.
24 * The following types have their base type fully specified and are exposed as appropriate TypeDefinition sub-interfaces:
29 * <li>int{8,16,32,64}</li>
31 * <li>uint{8,16,32,64}</li>
34 * The following types require additional specification in the model and are exposed by means of a specialized
35 * {@link TypeBuilder}s for each type:
38 * <li>instance-identifier</li>
39 * <li>enumeration</li>
40 * <li>identityref</li>
46 public final class BaseTypes {
48 throw new UnsupportedOperationException();
51 public static BinaryTypeDefinition binaryType() {
52 return BaseBinaryType.INSTANCE;
55 public static BitsTypeBuilder bitsTypeBuilder(final SchemaPath path) {
56 return new BitsTypeBuilder(path);
59 public static BooleanTypeDefinition booleanType() {
60 return BaseBooleanType.INSTANCE;
63 public static DecimalTypeBuilder decimalTypeBuilder(final SchemaPath path) {
64 return new DecimalTypeBuilder(path);
67 public static EmptyTypeDefinition emptyType() {
68 return BaseEmptyType.INSTANCE;
71 public static EnumerationTypeBuilder enumerationTypeBuilder(final SchemaPath path) {
72 return new EnumerationTypeBuilder(path);
75 public static IdentityrefTypeBuilder identityrefTypeBuilder(final SchemaPath path) {
76 return new IdentityrefTypeBuilder(path);
79 public static InstanceIdentifierTypeDefinition instanceIdentifierType() {
80 return BaseInstanceIdentifierType.INSTANCE;
83 public static IntegerTypeDefinition int8Type() {
84 return BaseInt8Type.INSTANCE;
87 public static IntegerTypeDefinition int16Type() {
88 return BaseInt16Type.INSTANCE;
91 public static IntegerTypeDefinition int32Type() {
92 return BaseInt32Type.INSTANCE;
95 public static IntegerTypeDefinition int64Type() {
96 return BaseInt64Type.INSTANCE;
99 public static LeafrefTypeBuilder leafrefTypeBuilder(final SchemaPath path) {
100 return new LeafrefTypeBuilder(path);
103 public static StringTypeDefinition stringType() {
104 return BaseStringType.INSTANCE;
107 public static UnionTypeBuilder unionTypeBuilder(final SchemaPath path) {
108 return new UnionTypeBuilder(path);
111 public static UnsignedIntegerTypeDefinition uint8Type() {
112 return BaseUint8Type.INSTANCE;
115 public static UnsignedIntegerTypeDefinition uint16Type() {
116 return BaseUint16Type.INSTANCE;
119 public static UnsignedIntegerTypeDefinition uint32Type() {
120 return BaseUint32Type.INSTANCE;
123 public static UnsignedIntegerTypeDefinition uint64Type() {
124 return BaseUint64Type.INSTANCE;