diff options
author | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2020-07-02 15:07:04 +0200 |
---|---|---|
committer | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2020-07-14 11:40:35 +0200 |
commit | b93e6a61eb52c364c43190f40c33aa9045ad90d2 (patch) | |
tree | 1461e12c4c7285dc5fbb630a12b3daa54e88ab11 /csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java | |
parent | acc4f065bea5608a4e812f6126c102abe8206748 (diff) |
Convert yaml schema into tree structure
Issue-ID: VNFSDK-594
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: I071095347fbdf824205e63ab9771cdf47d2ad29d
Diffstat (limited to 'csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java b/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java new file mode 100644 index 0000000..28913a2 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNode.java @@ -0,0 +1,66 @@ +/* + * Copyright 2020 Nokia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.onap.validation.yaml.schema.node; + +import org.onap.validation.yaml.exception.YamlProcessingException; + +import java.util.List; + +public abstract class YamlSchemaNode { + + private final String path; + private final String name; + private final boolean required; + private final String comment; + + + public String getName() { + return name; + } + + public String getPath() { + return path; + } + + public boolean isRequired() { + return required; + } + + public abstract List<String> getAcceptedValues(); + + public abstract List<YamlSchemaNode> getNextNodes() throws YamlSchemaProcessingException; + + public abstract boolean isContainingSubStructure(); + + public String getComment() { + return comment; + } + + YamlSchemaNode(String name, String path, boolean required, String comment) { + this.name = name; + this.path = path; + this.required = required; + this.comment = comment; + } + + static class YamlSchemaProcessingException extends YamlProcessingException { + YamlSchemaProcessingException(Throwable throwable) { + super(throwable); + } + } +} |