com.relogiclabs.json.schema.internal.tree.FunctionKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of relogiclabs-json-schema Show documentation
Show all versions of relogiclabs-json-schema Show documentation
The New JSON Schema prioritizes simplicity, conciseness, and readability, making
it user-friendly and accessible without the need for extensive prior knowledge.
It offers efficient read-write facilities, precise JSON document definition
through various data types and functions, and extensibility to meet modern web
service diverse requirements.
package com.relogiclabs.json.schema.internal.tree;
import com.relogiclabs.json.schema.type.JFunction;
import java.lang.reflect.Method;
import static org.apache.commons.lang3.StringUtils.removeStart;
import static org.apache.commons.lang3.StringUtils.uncapitalize;
public record FunctionKey(String functionName, int parameterCount) {
private static final String ESCAPED_PREFIX = "_";
public FunctionKey(Method method, int parameterCount) {
this(toFunctionName(method), parameterCount);
}
public FunctionKey(JFunction function) {
this(function.getName(), function.getArguments().size() + 1);
}
private static String toFunctionName(Method method) {
return "@" + uncapitalize(removeStart(method.getName(), ESCAPED_PREFIX));
}
}