/*
 * Copyright 2019 Immutables Authors and Contributors
 *
 * 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 org.immutables.criteria.expression;

import java.util.Objects;

/**
 * Standard implementation of {@link Operator} interface. For now, used only
 * as a container.
 */
class SimpleOperator implements Operator {

  private final String name;
  private final Class<?> type;

  SimpleOperator(String name, Class<?> type) {
    this.name = Objects.requireNonNull(name, "name");
    this.type = Objects.requireNonNull(type, "type");
  }

  @Override
  public String name() {
    return name;
  }

  @Override
  public Class<?> returnType() {
    return type;
  }

  @Override
  public boolean equals(Object other) {
    if (this == other) return true;
    if (other == null || getClass() != other.getClass()) return false;
    SimpleOperator that = (SimpleOperator) other;
    return Objects.equals(name, that.name) &&
            Objects.equals(type, that.type);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, type);
  }
}

@@ -655,16 +655,60 @@
 ssion;%0A%0A
+import com.google.common.base.MoreObjects;%0A%0A
 import j
@@ -725,16 +725,16 @@
 bjects;%0A
-
 %0A/**%0A * 
@@ -974,17 +974,23 @@
 lass%3C?%3E 
-t
+returnT
 ype) %7B%0A 
@@ -1085,16 +1085,28 @@
 ull(
-type, %22t
+returnType, %22returnT
 ype%22
@@ -1578,24 +1578,24 @@
 ashCode() %7B%0A
-
     return O
@@ -1622,11 +1622,218 @@
 pe);%0A  %7D
+%0A%0A  @Override%0A  public String toString() %7B%0A    return MoreObjects.toStringHelper(this)%0A            .add(%22name%22, name)%0A            .add(%22returnType%22, returnType().getSimpleName())%0A            .toString();%0A  %7D
 %0A%7D%0A

Implement toString() for SimpleOperator