/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.yang.model.util;
-import java.net.URI;
import java.util.Collections;
-import java.util.Date;
import java.util.List;
import org.opendaylight.controller.yang.common.QName;
import org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition;
/**
- * The <code>default</code> implementation of Instance Identifier Type Definition interface.
+ * The <code>default</code> implementation of Instance Identifier Type
+ * Definition interface.
*
* @see InstanceIdentifierTypeDefinition
*/
-public class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
-
- private static final QName name = BaseTypes
- .constructQName("instance-identifier");
- private static final String description = "The instance-identifier built-in type is used to " +
- "uniquely identify a particular instance node in the data tree.";
+public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
+ private static final QName name = BaseTypes.constructQName("instance-identifier");
+ private static final String description = "The instance-identifier built-in type is used to "
+ + "uniquely identify a particular instance node in the data tree.";
private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.13";
private final transient SchemaPath path;
private final RevisionAwareXPath xpath;
private final String units = "";
private final InstanceIdentifierTypeDefinition baseType;
- private final boolean requireInstance;
+ private boolean requireInstance = true;
- private InstanceIdentifier(RevisionAwareXPath xpath, boolean requireInstance) {
+ public InstanceIdentifier(final SchemaPath path, final RevisionAwareXPath xpath) {
super();
- path = BaseTypes.schemaPath(name);
+ this.path = path;
this.xpath = xpath;
- this.requireInstance = requireInstance;
this.baseType = this;
}
- public InstanceIdentifier(final List<String> actualPath, final URI namespace,
- final Date revision, RevisionAwareXPath xpath, boolean requireInstance) {
+ public InstanceIdentifier(final SchemaPath path, final RevisionAwareXPath xpath, final boolean requireInstance) {
super();
- path = BaseTypes.schemaPath(actualPath, namespace, revision);
+ this.path = path;
this.xpath = xpath;
this.requireInstance = requireInstance;
- this.baseType = new InstanceIdentifier(xpath, requireInstance);
+ this.baseType = this;
}
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
+ * @see
+ * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public InstanceIdentifierTypeDefinition getBaseType() {
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
+ * @see
+ * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
+ * ()
*/
@Override
public Object getDefaultValue() {
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
+ * @see
+ * org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
*/
@Override
public String getDescription() {
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes()
+ * @see
+ * org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes
+ * ()
*/
@Override
public List<UnknownSchemaNode> getUnknownSchemaNodes() {
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#
- * getPathStatement()
+ * @see org.opendaylight.controller.yang.model.api.type.
+ * InstanceIdentifierTypeDefinition# getPathStatement()
*/
@Override
public RevisionAwareXPath getPathStatement() {
/*
* (non-Javadoc)
*
- * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#
- * requireInstance()
+ * @see org.opendaylight.controller.yang.model.api.type.
+ * InstanceIdentifierTypeDefinition# requireInstance()
*/
@Override
public boolean requireInstance() {