@Retention(value=RUNTIME) @Target(value=TYPE) @Documented public @interface FunctionRegistry
@FunctionRegistry
public interface MyFunctions {
Integer sumOf(int val1, int val2);
Long toLong(Date javaDate);
}
@FunctionRegistry
public interface MyFunctionRegistry {
String toString(long value);
String toString(int value); // OK because parameter type is different
String toString(long value); // KO because same signature as the first function
}
Remark 1: functions return types cannot be primitive, use boxed types instead
@FunctionRegistry
public interface FunctionsWithCodecSystemRegistry {
// CQL function signature = listtojson(consistencylevels list<text>), returns text
String listToJson(List<@Enumerated ConsistencyLevel> consistencyLevels);
// CQL function signature = getinvalue(input text), returns text
@Codec(IntToString.class) String getIntValue(String input);
}
Remark 3: functions name and parameters' name are lower-cased by Cassandra automatically
public abstract String keyspace
@FunctionRegistry(keyspace="production")
public class MyFunctions {...}
Copyright © 2012-2021. All Rights Reserved.