*/
package org.opendaylight.yangtools.yang.parser.builder.impl;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.AbstractTypeAwareBuilder;
+import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
+import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder implements DataSchemaNodeBuilder {
private LeafListSchemaNodeImpl instance;
public LeafListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
super(moduleName, line, qname);
- this.schemaPath = path;
- constraints = new ConstraintsBuilder(moduleName, line);
+ this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
+ constraints = new ConstraintsBuilderImpl(moduleName, line);
}
public LeafListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
final LeafListSchemaNode base) {
super(moduleName, line, qname);
- schemaPath = path;
- constraints = new ConstraintsBuilder(moduleName, line, base.getConstraints());
+ this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
+ constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
description = base.getDescription();
reference = base.getReference();
instance.augmenting = augmenting;
instance.addedByUses = addedByUses;
instance.configuration = configuration;
- instance.constraintsDef = constraints.build();
+ instance.constraintsDef = constraints.toInstance();
instance.userOrdered = userOrdered;
if (type == null) {
}
@Override
- public void setPath(SchemaPath path) {
+ public void setPath(final SchemaPath path) {
this.schemaPath = path;
}
}
@Override
- public void setStatus(Status status) {
+ public void setStatus(final Status status) {
this.status = Preconditions.checkNotNull(status, "status cannot be null");
}
}
@Override
- public void setAugmenting(boolean augmenting) {
+ public void setAugmenting(final boolean augmenting) {
this.augmenting = augmenting;
}
}
@Override
- public void setConfiguration(boolean configuration) {
+ public void setConfiguration(final boolean configuration) {
this.configuration = configuration;
}
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
} else if (!schemaPath.equals(other.schemaPath)) {
return false;
}
- if (parentBuilder == null) {
- if (other.parentBuilder != null) {
+ if (getParent() == null) {
+ if (other.getParent() != null) {
return false;
}
- } else if (!parentBuilder.equals(other.parentBuilder)) {
+ } else if (!getParent().equals(other.getParent())) {
return false;
}
return true;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}