package io.vertx.codegen.type;

import io.vertx.codegen.Helper;

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

/**
 * @author <a href="mailto:cafeinoman@openaliasbox.org>Francois Delalleau</a>
 */
public class AnnotationValueInfo {

  private String name;
  private String simpleName;
  private String packageName;
  private Map<String, Object> values;

  public AnnotationValueInfo(String name) {
    this(name, new HashMap<>());
  }

  public AnnotationValueInfo(String name, Map<String, Object> values) {
    this.name = name;
    this.simpleName = Helper.getSimpleName(name);
    this.packageName = Helper.getPackageName(name);
    this.values = values != null ? values : new HashMap<>();
  }

  public boolean isEmpty() {
    return values.isEmpty();
  }

  public void putMember(String memberName, Object memberValue) {
    values.put(memberName, memberValue);
  }

  public String getName() {
    return name;
  }

  public String getSimpleName() {
    return simpleName;
  }

  public String getPackageName() {
    return packageName;
  }

  public List<String> getMembersNames() {
    return new ArrayList<>(values.keySet());
  }

  public Object getMember(String name) {
    return values.getOrDefault(name, null);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    AnnotationValueInfo that = (AnnotationValueInfo) o;

    if (!name.equals(that.name)) return false;
    return values.equals(that.values);
  }

  @Override
  public int hashCode() {
    int result = name.hashCode();
    result = 31 * result + values.hashCode();
    return result;
  }
}

@@ -62,36 +62,8 @@
 r;%0A%0A
-import java.util.ArrayList;%0A
 impo
@@ -101,20 +101,19 @@
 va.util.
-List
+Map
 ;%0Aimport
@@ -123,19 +123,19 @@
 va.util.
-Map
+Set
 ;%0A%0A/**%0A 
@@ -1075,19 +1075,18 @@
  public 
-Lis
+Se
 t%3CString
@@ -1122,24 +1122,8 @@
 urn 
-new ArrayList%3C%3E(
 valu
@@ -1133,17 +1133,16 @@
 keySet()
-)
 ;%0A  %7D%0A%0A 

Change List to Set to keep it simple