package com.realcomp.data.conversion;

import com.realcomp.data.DataType;
import com.realcomp.data.Operation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A Converter for the STRING data DataType
 * 
 * @author krenfro
 */
public class StringConverter implements Converter{

    protected List<DataType> supportedTypes;

    public StringConverter(){
        supportedTypes = new ArrayList<DataType>();     
        supportedTypes.add(DataType.STRING);
    }

    @Override
    public Object convert(Object value) throws ConversionException{
        return value == null ? null : value.toString();
    }

    /**
     * 
     * @return List of DataTypes supported by this converter. All Types except Map and List
     */
    @Override
    public List<DataType> getSupportedTypes(){
        return Collections.unmodifiableList(supportedTypes);
    }

    @Override
    public Operation copyOf() {
        return new StringConverter();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final StringConverter other = (StringConverter) obj;
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

}

@@ -183,16 +183,42 @@
 il.List;
+%0Aimport java.util.Objects;
 %0A%0A/**%0A *
@@ -261,17 +261,16 @@
 aType%0A *
- 
 %0A * @aut
@@ -464,21 +464,16 @@
 Type%3E();
-     
 %0A       
@@ -676,17 +676,16 @@
 *%0A     *
- 
 %0A     * 
@@ -989,32 +989,189 @@
 erter();%0A    %7D%0A%0A
+    @Override%0A    public int hashCode()%7B%0A        int hash = 7;%0A        hash = 67 * hash + Objects.hashCode(this.supportedTypes);%0A        return hash;%0A    %7D%0A%0A
     @Override%0A  
@@ -1205,17 +1205,16 @@
 ect obj)
- 
 %7B%0A      
@@ -1231,16 +1231,17 @@
 == null)
+%7B
 %0A       
@@ -1251,32 +1251,42 @@
   return false;%0A
+        %7D%0A
         if (getC
@@ -1310,16 +1310,17 @@
 Class())
+%7B
 %0A       
@@ -1330,32 +1330,42 @@
   return false;%0A
+        %7D%0A
         final St
@@ -1421,91 +1421,108 @@
     
-return true;
+if (!Objects.equals(this.supportedTypes, other.supportedTypes))%7B
 %0A    
-%7D%0A%0A
     
-@Override%0A    public int hashCode() %7B%0A        int hash = 5;
+    return false;%0A        %7D
 %0A   
@@ -1525,31 +1525,31 @@
 %0A        return 
-hash
+true
 ;%0A    %7D%0A%0A%7D%0A
@@ -1546,10 +1546,17 @@
 %0A    %7D%0A%0A
+    %0A%0A%0A
 %7D%0A

Updated hashCode and equals.