/*
 * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you 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.wso2.carbon.siddhi.editor.core.util.designview.beans.factories;

import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.AnnotationConfig;
import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.ListAnnotationConfig;
import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.MapAnnotationConfig;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Factory to create Siddhi Annotation config
 */
public class AnnotationConfigFactory {
    public AnnotationConfig getAnnotationConfig(String name, String value) {
        return new ListAnnotationConfig(name, new ArrayList<>(Arrays.asList(value)));
    }

    public AnnotationConfig getAnnotationConfig(String name, List<String> values) {
        return new ListAnnotationConfig(name, values);
    }

    public AnnotationConfig getAnnotationConfig(String name, Map<String, String> elements) {
        return new MapAnnotationConfig(name, elements);
    }
}

@@ -1215,16 +1215,282 @@
 ctory %7B%0A
+    /**%0A     * Returns a ListAnnotationConfig with the given name and values%0A     * @param name      Name of the annotation%0A     * @param values    List of values, inside the annotation%0A     * @return          ListAnnotationConfig, with given list's members%0A     */%0A
     publ
@@ -1546,20 +1546,27 @@
 me, 
+List%3C
 String
+%3E
  value
+s
 ) %7B%0A
@@ -1615,54 +1615,294 @@
 me, 
-new ArrayList%3C%3E(Arrays.asList(value)));
+values);%0A    %7D%0A%0A    /**%0A     * Returns a MapAnnotationConfig with the given name and values%0A     * @param name      Name of the annotation%0A     * @param elements  Option Value pairs, inside the annotation%0A     * @return          MapAnnotationConfig, with the given map's members
 %0A    
-%7D%0A
+ */
 %0A   
@@ -1959,34 +1959,43 @@
 g name, 
-List
+Map
 %3CString
-%3E value
+, String%3E element
 s) %7B%0A   
@@ -2014,50 +2014,379 @@
 new 
-ListAnnotationConfig(name, values);%0A    %7D%0A
+MapAnnotationConfig(name, elements);%0A    %7D%0A%0A    /**%0A     * Returns a ListAnnotationConfig with the given name and value. Single value is added as the only list member%0A     * @param name      Name of the annotation%0A     * @param value     Value inside the annotation%0A     * @return          ListAnnotationConfig, with the given value as the only member of the list%0A     */
 %0A   
@@ -2447,39 +2447,60 @@
 me, 
-Map%3C
 String
-, String%3E elements) %7B
+ value) %7B // TODO: 4/1/18 Might have to remove
 %0A   
@@ -2507,35 +2507,36 @@
      return new 
-Map
+List
 AnnotationConfig
@@ -2538,31 +2538,60 @@
 onfig(name, 
-elements
+new ArrayList%3C%3E(Arrays.asList(value))
 );%0A    %7D%0A%7D%0A

Add comments for methods in AnnotationConfigFactory