public final class SerializerHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.onosproject.yang.model.DataNode.Builder |
addDataNode(org.onosproject.yang.model.DataNode.Builder builder,
String name,
String namespace,
String value,
org.onosproject.yang.model.DataNode.Type type)
Adds a data node to a given data node builder.
|
static org.onosproject.yang.model.DataNode.Builder |
addDataNode(org.onosproject.yang.model.DataNode.Builder builder,
String name,
String namespace,
String value,
String valNamespace,
org.onosproject.yang.model.DataNode.Type type)
Adds a data node to a given data node builder.
|
static org.onosproject.yang.model.ResourceId.Builder |
addToResourceId(org.onosproject.yang.model.ResourceId.Builder builder,
String name,
String namespace,
List<String> value)
Adds to resource identifier builder, this API will be used by
applications which are not aware about the schema name association
with key's value.
|
static org.onosproject.yang.model.ResourceId.Builder |
addToResourceId(org.onosproject.yang.model.ResourceId.Builder builder,
String name,
String namespace,
String value)
Adds to resource identifier builder.
|
static String |
errorMsg(String fmt,
Object... params)
Returns the error string by filling the parameters in the given
formatted error string.
|
static org.onosproject.yang.model.DataNode.Builder |
exitDataNode(org.onosproject.yang.model.DataNode.Builder builder)
Exits a given data node builder.
|
static org.onosproject.yang.model.SchemaContext |
getChildSchemaContext(org.onosproject.yang.model.SchemaContext context,
String name,
String namespace)
Returns child schema context for request name and namespace from given
resourceId builder.
|
static String |
getModuleNameFromNameSpace(YangSerializerContext c,
String ns)
Returns the yang module name for given namespace.
|
static org.onosproject.yang.model.ResourceId |
getResourceId(org.onosproject.yang.model.DataNode.Builder builder)
Returns resource identifier for a given data node.
|
static org.onosproject.yang.model.DataNode.Builder |
initializeDataNode(org.onosproject.yang.model.ResourceId.Builder builder)
Initializes a new data node builder using resource identifier builder.
|
static org.onosproject.yang.model.DataNode.Builder |
initializeDataNode(YangSerializerContext context)
Initializes a new data node builder.
|
static org.onosproject.yang.model.ResourceId.Builder |
initializeResourceId(YangSerializerContext context)
Initializes resource identifier builder with YANG serializer context
information.
|
public static org.onosproject.yang.model.ResourceId.Builder initializeResourceId(YangSerializerContext context)
context - YANG serializer contextpublic static org.onosproject.yang.model.ResourceId.Builder addToResourceId(org.onosproject.yang.model.ResourceId.Builder builder,
String name,
String namespace,
String value)
Builder and name are mandatory inputs, In case namespace is null, namespace of last key in the keylist of resource identifier builder will be used. Value should only be provided for leaf-list/list.
This API will also carry out necessary schema related validations.
builder - resource identifier buildername - name of nodenamespace - namespace of nodevalue - value of nodeIllegalArgumentException - when given input is not as per the
schema contextIllegalStateException - when a key is added under a atomic childpublic static org.onosproject.yang.model.ResourceId.Builder addToResourceId(org.onosproject.yang.model.ResourceId.Builder builder,
String name,
String namespace,
List<String> value)
throws IllegalArgumentException
Builder and name are mandatory inputs, In case namespace is null, namespace of last key in the key list of resource identifier builder will be used. Value should only be provided for leaf-list/list.
In case of list its mandatory to pass either all key values of list or non of them (wild card to support get operation).
This API will also carry out necessary schema related validations.
builder - resource identifier buildername - name of nodenamespace - namespace of nodevalue - ordered list of valuesIllegalArgumentException - when given input is not as per the
schema contextIllegalStateException - when a key is added under a atomic childpublic static org.onosproject.yang.model.DataNode.Builder initializeDataNode(org.onosproject.yang.model.ResourceId.Builder builder)
This API can only be used when passed parameter resourceId builder is prepared with the help of serializer helper utility.
builder - resource identifier builderpublic static org.onosproject.yang.model.DataNode.Builder initializeDataNode(YangSerializerContext context)
context - YANG serializer contextpublic static org.onosproject.yang.model.DataNode.Builder addDataNode(org.onosproject.yang.model.DataNode.Builder builder,
String name,
String namespace,
String value,
org.onosproject.yang.model.DataNode.Type type)
Name and builder is mandatory inputs. If namespace is not provided parents namespace will be added for data node. Value should be provided for leaf/leaf-list. In case of leaf-list it's expected that this API is called for each leaf-list instance. Callers aware about the node type can opt to provide data node type, implementation will carry out validations based on input type and obtained type.
This API will also carry out necessary schema related validations.
builder - data node buildername - name of data nodenamespace - namespace of data nodevalue - value of data nodetype - type of data nodeIllegalArgumentException - when given input is not as per the
schema contextIllegalStateException - when a key is added under a atomic childpublic static org.onosproject.yang.model.DataNode.Builder addDataNode(org.onosproject.yang.model.DataNode.Builder builder,
String name,
String namespace,
String value,
String valNamespace,
org.onosproject.yang.model.DataNode.Type type)
Name and builder is mandatory inputs. If namespace is not provided parents namespace will be added for data node. Value should be provided for leaf/leaf-list. In case of leaf-list it's expected that this API is called for each leaf-list instance. Callers aware about the node type can opt to provide data node type, implementation will carry out validations based on input type and obtained type.
This API will also carry out necessary schema related validations.
builder - data node buildername - name of data nodenamespace - namespace of data nodevalue - value of data nodevalNamespace - value's namespace, either module name of namespace,
null indicates its same as leaftype - type of data nodeIllegalArgumentException - when given input is not as per the
schema contextIllegalStateException - when a key is added under a atomic childpublic static org.onosproject.yang.model.ResourceId getResourceId(org.onosproject.yang.model.DataNode.Builder builder)
builder - data node builderpublic static org.onosproject.yang.model.DataNode.Builder exitDataNode(org.onosproject.yang.model.DataNode.Builder builder)
In case current data node is topmost node (which was created using last key of resource identifier), current data node will not be built and null will be returned, in such case caller is expected to build data node from builder.
This API will also carry out necessary exit time validations, for an example validation about all key leafs presence for a list.
builder - data node builderpublic static org.onosproject.yang.model.SchemaContext getChildSchemaContext(org.onosproject.yang.model.SchemaContext context,
String name,
String namespace)
throws IllegalArgumentException
context - parent schema contextname - name of the child nodenamespace - namespace of the child nodeIllegalArgumentException - on argument errorpublic static String errorMsg(String fmt, Object... params)
fmt - error format stringparams - parameters to be filled in formatted stringpublic static String getModuleNameFromNameSpace(YangSerializerContext c, String ns)
c - YANG serializer contextns - namespace of the moduleCopyright © 2018. All rights reserved.