Skip to content

Commit

Permalink
refactor: return oringl code at default funcion
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Nov 11, 2023
1 parent 0ddde3c commit 35a32d1
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,33 @@

package org.eclipse.jnosql.communication.query;

import java.util.Arrays;
import java.util.Objects;

record DefaultFunction(String name, Object[] params) implements Function {

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultFunction that)) {
return false;
}
return Objects.equals(name, that.name) &&
Arrays.equals(params, that.params);
}

@Override
public int hashCode() {
return 31 * Objects.hashCode(name) + Arrays.hashCode(params);
}

@Override
public String toString() {
return name + "(" + Arrays.toString(params) + ")";
}

static Function of(String name, Object[] args) {
return new DefaultFunction(name, args);
}
Expand Down

0 comments on commit 35a32d1

Please sign in to comment.