/*
 * 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 com.facebook.presto.spi.function;

import com.facebook.presto.spi.api.Experimental;
import com.facebook.presto.spi.type.TypeSignature;

import java.util.List;
import java.util.Objects;

import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.joining;

@Experimental
public class SqlFunctionId
{
    private final QualifiedFunctionName functionName;
    private final List<TypeSignature> argumentTypes;

    public SqlFunctionId(
            QualifiedFunctionName functionName,
            List<TypeSignature> argumentTypes)
    {
        this.functionName = requireNonNull(functionName, "functionName is null");
        this.argumentTypes = requireNonNull(argumentTypes, "argumentTypes is null");
    }

    public QualifiedFunctionName getFunctionName()
    {
        return functionName;
    }

    public List<TypeSignature> getArgumentTypes()
    {
        return argumentTypes;
    }

    public String getId()
    {
        return toString();
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        SqlFunctionId o = (SqlFunctionId) obj;
        return Objects.equals(functionName, o.functionName)
                && Objects.equals(argumentTypes, o.argumentTypes);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(functionName, argumentTypes);
    }

    @Override
    public String toString()
    {
        String arguments = argumentTypes.stream()
                .map(Object::toString)
                .collect(joining(", "));
        return format("%s(%s)", functionName, arguments);
    }
}

@@ -697,16 +697,123 @@
 gnature;
+%0Aimport com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonProperty;
 %0A%0Aimport
@@ -1146,16 +1146,33 @@
 Types;%0A%0A
+    @JsonCreator%0A
     publ
@@ -1200,16 +1200,46 @@
         
+ @JsonProperty(%22functionName%22)
  Qualifi
@@ -1278,16 +1278,47 @@
         
+ @JsonProperty(%22argumentTypes%22)
  List%3CTy
@@ -1517,32 +1517,50 @@
  null%22);%0A    %7D%0A%0A
+    @JsonProperty%0A
     public Quali
@@ -1628,32 +1628,50 @@
 ionName;%0A    %7D%0A%0A
+    @JsonProperty%0A
     public List%3C

Add JSON annotations to SqlFunctionId