X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FExtendedType.java;h=86bde24d62d8131314f0f1d37b7e8ed61552f72e;hb=9ceed566491d172e02220b04ec6869867f2f2473;hp=2057a42eb6490bf659d11149ff85bb138326634b;hpb=f9de1cd89c17888a2bd02486d5f7519f0b391bba;p=controller.git diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java index 2057a42eb6..86bde24d62 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java @@ -1,13 +1,15 @@ /* - * 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; @@ -33,7 +35,6 @@ public class ExtendedType implements TypeDefinition> { private List patterns = Collections.emptyList(); private Integer fractionDigits = null; - private Status status; private String units; private Object defaultValue; @@ -46,7 +47,8 @@ public class ExtendedType implements TypeDefinition> { private final String description; private final String reference; - private List unknownSchemaNodes = Collections.emptyList();; + private List unknownSchemaNodes = Collections + .emptyList(); private Status status = Status.CURRENT; private String units = ""; private Object defaultValue = null; @@ -56,11 +58,23 @@ public class ExtendedType implements TypeDefinition> { private List patterns = Collections.emptyList(); private Integer fractionDigits = null; + public Builder(final List actualPath, final URI namespace, + final Date revision, final QName typeName, + TypeDefinition baseType, final String description, + final String reference) { + this.typeName = typeName; + this.baseType = baseType; + this.path = BaseTypes.schemaPath(actualPath, namespace, revision); + this.description = description; + this.reference = reference; + } + public Builder(final QName typeName, TypeDefinition baseType, - final String description, final String reference) { + final String description, final String reference, + SchemaPath path) { this.typeName = typeName; this.baseType = baseType; - this.path = BaseTypes.schemaPath(typeName); + this.path = path; this.description = description; this.reference = reference; } @@ -80,27 +94,28 @@ public class ExtendedType implements TypeDefinition> { return this; } - public Builder unknownSchemaNodes(final List unknownSchemaNodes) { + public Builder unknownSchemaNodes( + final List unknownSchemaNodes) { this.unknownSchemaNodes = unknownSchemaNodes; return this; } public Builder ranges(final List ranges) { - if(ranges != null) { + if (ranges != null) { this.ranges = ranges; } return this; } public Builder lengths(final List lengths) { - if(lengths != null) { + if (lengths != null) { this.lengths = lengths; } return this; } public Builder patterns(final List patterns) { - if(patterns != null) { + if (patterns != null) { this.patterns = patterns; } return this; @@ -188,8 +203,10 @@ public class ExtendedType implements TypeDefinition> { + ((defaultValue == null) ? 0 : defaultValue.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result - + ((unknownSchemaNodes == null) ? 0 : unknownSchemaNodes.hashCode()); + result = prime + * result + + ((unknownSchemaNodes == null) ? 0 : unknownSchemaNodes + .hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((reference == null) ? 0 : reference.hashCode());