X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FBinaryType.java;h=ea09b65b5daa1382847faff9a4429eadee79d5fd;hp=253fe484f0459a7f410014814a549166c5477dbd;hb=9ceed566491d172e02220b04ec6869867f2f2473;hpb=9fab620d933bab1ddf7eef39087fa515e6d0c988 diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/BinaryType.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/BinaryType.java index 253fe484f0..ea09b65b5d 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/BinaryType.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/BinaryType.java @@ -1,16 +1,14 @@ /* - * 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.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.List; import org.opendaylight.controller.yang.common.QName; @@ -25,70 +23,41 @@ import org.opendaylight.controller.yang.model.api.type.LengthConstraint; * * @see BinaryTypeDefinition */ -public class BinaryType implements BinaryTypeDefinition { - +public final class BinaryType implements BinaryTypeDefinition { private final QName name = BaseTypes.constructQName("binary"); private final SchemaPath path; private final String description = "The binary built-in type represents any binary data, i.e., a sequence of octets."; private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.8"; private final BinaryTypeDefinition baseType; - private List bytes; + private final List bytes; private final List lengthConstraints; - private String units = ""; - - private BinaryType() { - super(); + private final String units = ""; + public BinaryType(final SchemaPath path) { final List constraints = new ArrayList(); - constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); + constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", + "")); this.lengthConstraints = Collections.unmodifiableList(constraints); this.bytes = Collections.emptyList(); - this.path = BaseTypes.schemaPath(name); + this.path = path; this.baseType = this; } - public BinaryType(final List actualPath, final URI namespace, - final Date revision) { - super(); - + public BinaryType(final SchemaPath path, final List bytes) { final List constraints = new ArrayList(); - constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); + constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", + "")); this.lengthConstraints = Collections.unmodifiableList(constraints); - this.bytes = Collections.emptyList(); - this.path = BaseTypes.schemaPath(actualPath, namespace, revision); - this.baseType = new BinaryType(); - } - - /** - * - * - * @param bytes - * @param lengthConstraints - * @param units - */ - public BinaryType(final List actualPath, final URI namespace, - final Date revision, final List bytes, - final List lengthConstraints, final String units) { - super(); - - if ((lengthConstraints == null) || (lengthConstraints.isEmpty())) { - final List constraints = new ArrayList(); - constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); - this.lengthConstraints = Collections.unmodifiableList(constraints); - } else { - this.lengthConstraints = Collections.unmodifiableList(lengthConstraints); - } - - this.path = BaseTypes.schemaPath(actualPath, namespace, revision); this.bytes = Collections.unmodifiableList(bytes); - this.units = units; - this.baseType = new BinaryType(); + this.path = path; + 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 BinaryTypeDefinition getBaseType() { @@ -108,7 +77,9 @@ public class BinaryType implements BinaryTypeDefinition { /* * (non-Javadoc) * - * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue() + * @see + * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue + * () */ @Override public Object getDefaultValue() { @@ -138,7 +109,8 @@ public class BinaryType implements BinaryTypeDefinition { /* * (non-Javadoc) * - * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription() + * @see + * org.opendaylight.controller.yang.model.api.SchemaNode#getDescription() */ @Override public String getDescription() { @@ -169,8 +141,8 @@ public class BinaryType implements BinaryTypeDefinition { * (non-Javadoc) * * @see - * org.opendaylight.controller.yang.model.base.type.api.BinaryTypeDefinition#getLengthConstraint - * () + * org.opendaylight.controller.yang.model.base.type.api.BinaryTypeDefinition + * #getLengthConstraint () */ @Override public List getLengthConstraints() { @@ -191,7 +163,8 @@ public class BinaryType implements BinaryTypeDefinition { + ((description == null) ? 0 : description.hashCode()); result = prime * result - + ((lengthConstraints == null) ? 0 : lengthConstraints.hashCode()); + + ((lengthConstraints == null) ? 0 : lengthConstraints + .hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result