Skip to content

Commit

Permalink
refactor: update record at function
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 f919078 commit ca1338a
Showing 1 changed file with 1 addition and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,8 @@

package org.eclipse.jnosql.communication.query;

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

final class DefaultFunction implements Function {

private final String name;

private final Object[] args;

private DefaultFunction(String name, Object[] args) {
this.name = name;
this.args = args;
}

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

@Override
public Object[] params() {
return args;
}

@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(args, that.args);
}

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

@Override
public String toString() {
return name + "(" + Arrays.toString(args) + ")";
}
record DefaultFunction(String name, Object[] params) implements Function {

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

0 comments on commit ca1338a

Please sign in to comment.