1 package org.openecomp.sdc.be.components.utils;
3 import org.openecomp.sdc.be.datatypes.elements.Annotation;
4 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
5 import org.openecomp.sdc.be.model.PropertyDefinition;
7 import java.util.ArrayList;
10 public class AnnotationBuilder {
12 private Annotation annotation;
14 private AnnotationBuilder() {
15 annotation = new Annotation();
18 public static AnnotationBuilder create() {
19 return new AnnotationBuilder();
22 public AnnotationBuilder setType(String type) {
23 annotation.setType(type);
27 public AnnotationBuilder setName(String name) {
28 annotation.setName(name);
32 public AnnotationBuilder addProperty(String name) {
33 PropertyDefinition prop = new PropertyDataDefinitionBuilder()
36 List<PropertyDataDefinition> annotationProps = getAnnotationProps();
37 annotationProps.add(prop);
41 public Annotation build() {
45 private List<PropertyDataDefinition> getAnnotationProps() {
46 if (annotation.getProperties() == null) {
47 annotation.setProperties(new ArrayList<>());
49 return annotation.getProperties();