*/
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;
*
* @see StringTypeDefinition
*/
-public class StringType implements StringTypeDefinition {
-
- private final QName name = BaseTypes.constructQName("string");;
+public final class StringType implements StringTypeDefinition {
+ private final QName name = BaseTypes.constructQName("string");
private final SchemaPath path;
- private String defaultValue = "";
+ private final String defaultValue = "";
private final String description = "";
private final String reference = "";
private final List<LengthConstraint> lengthStatements;
private final List<PatternConstraint> patterns;
- private String units = "";
+ private final String units = "";
+ private final StringTypeDefinition baseType;
/**
* Default Constructor.
*/
- public StringType(final List<String> actualPath,
- final URI namespace, final Date revision) {
+ public StringType(final SchemaPath path) {
super();
- path = BaseTypes.schemaPath(actualPath, namespace, revision);
+ this.path = path;
final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
lengthStatements = Collections.unmodifiableList(constraints);
-
- this.patterns = Collections.emptyList();
- }
-
- /**
- *
- *
- * @param lengthStatements
- * @param patterns
- */
- public StringType(final List<String> actualPath,
- final URI namespace, final Date revision, final List<LengthConstraint> lengthStatements,
- final List<PatternConstraint> patterns) {
- super();
- path = BaseTypes.schemaPath(actualPath, namespace, revision);
- if(lengthStatements == null || lengthStatements.size() == 0) {
- final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
- constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
- this.lengthStatements = Collections.unmodifiableList(constraints);
- } else {
- this.lengthStatements = Collections.unmodifiableList(lengthStatements);
- }
- this.patterns = Collections.unmodifiableList(patterns);
- }
-
- /**
- *
- *
- * @param defaultValue
- * @param lengthStatements
- * @param patterns
- * @param units
- */
- public StringType(final List<String> actualPath,
- final URI namespace, final Date revision, final String defaultValue,
- final List<LengthConstraint> lengthStatements,
- final List<PatternConstraint> patterns, final String units) {
- super();
- path = BaseTypes.schemaPath(actualPath, namespace, revision);
- this.defaultValue = defaultValue;
- if(lengthStatements == null || lengthStatements.size() == 0) {
- final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
- constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
- this.lengthStatements = Collections.unmodifiableList(constraints);
- } else {
- this.lengthStatements = Collections.unmodifiableList(lengthStatements);
- }
- this.patterns = patterns;
- this.units = units;
+ patterns = Collections.emptyList();
+ baseType = this;
}
/*
*/
@Override
public StringTypeDefinition getBaseType() {
- return this;
+ return baseType;
}
/*