Package org.apache.cassandra.schema
Class Functions
- java.lang.Object
-
- org.apache.cassandra.schema.Functions
-
- All Implemented Interfaces:
java.lang.Iterable<Function>
public final class Functions extends java.lang.Object implements java.lang.Iterable<Function>
An immutable container for a keyspace's UDAs and UDFs (and, in case ofSystemKeyspace, native functions and aggregates).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFunctions.Builderstatic classFunctions.Filterstatic classFunctions.FunctionsDiff<T extends Function>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.stream.Stream<UDAggregate>aggregatesUsingFunction(Function function)static Functions.Builderbuilder()booleanequals(java.lang.Object o)Functionsfilter(java.util.function.Predicate<Function> predicate)java.util.Optional<Function>find(FunctionName name, java.util.List<AbstractType<?>> argTypes)java.util.Optional<Function>find(FunctionName name, java.util.List<AbstractType<?>> argTypes, Functions.Filter filter)Find the function with the specified namejava.util.Collection<Function>get(FunctionName name)Get all function overloads with the specified namejava.util.Collection<UDAggregate>getUdas(FunctionName name)Get all UDAs overloads with the specified namejava.util.Collection<UDFunction>getUdfs(FunctionName name)Get all UDFs overloads with the specified nameinthashCode()booleanisEmpty()java.util.Iterator<Function>iterator()static Functionsnone()static Functionsof(Function... funs)java.lang.Iterable<Function>referencingUserType(java.nio.ByteBuffer name)intsize()java.util.stream.Stream<Function>stream()java.lang.StringtoString()static inttypeHashCode(java.util.List<AbstractType<?>> types)static inttypeHashCode(AbstractType<?> t)static booleantypesMatch(java.util.List<AbstractType<?>> t1, java.util.List<AbstractType<?>> t2)java.util.stream.Stream<UDAggregate>udas()java.util.stream.Stream<UDFunction>udfs()Functionswith(Function fun)Create a Functions instance with the provided function addedFunctionswithAddedOrUpdated(Function function)Functionswithout(Function function)Functionswithout(FunctionName name, java.util.List<AbstractType<?>> argTypes)Creates a Functions instance with the function with the provided name and argument types removedFunctionswithUpdatedUserType(UserType udt)
-
-
-
Method Detail
-
builder
public static Functions.Builder builder()
-
none
public static Functions none()
-
iterator
public java.util.Iterator<Function> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Function>
-
stream
public java.util.stream.Stream<Function> stream()
-
size
public int size()
-
udfs
public java.util.stream.Stream<UDFunction> udfs()
- Returns:
- a stream of keyspace's UDFs
-
udas
public java.util.stream.Stream<UDAggregate> udas()
- Returns:
- a stream of keyspace's UDAs
-
referencingUserType
public java.lang.Iterable<Function> referencingUserType(java.nio.ByteBuffer name)
-
aggregatesUsingFunction
public java.util.stream.Stream<UDAggregate> aggregatesUsingFunction(Function function)
- Parameters:
function- the referree function- Returns:
- a stream of aggregates that use the provided function as either a state or a final function
-
get
public java.util.Collection<Function> get(FunctionName name)
Get all function overloads with the specified name- Parameters:
name- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
Functionotherwise
-
getUdfs
public java.util.Collection<UDFunction> getUdfs(FunctionName name)
Get all UDFs overloads with the specified name- Parameters:
name- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
UDFunctionotherwise
-
getUdas
public java.util.Collection<UDAggregate> getUdas(FunctionName name)
Get all UDAs overloads with the specified name- Parameters:
name- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
UDAggregateotherwise
-
find
public java.util.Optional<Function> find(FunctionName name, java.util.List<AbstractType<?>> argTypes)
-
find
public java.util.Optional<Function> find(FunctionName name, java.util.List<AbstractType<?>> argTypes, Functions.Filter filter)
Find the function with the specified name- Parameters:
name- fully qualified function nameargTypes- function argument types- Returns:
- an empty
Optionalif the function name is not found; a non-empty optional ofFunctionotherwise
-
isEmpty
public boolean isEmpty()
-
typesMatch
public static boolean typesMatch(java.util.List<AbstractType<?>> t1, java.util.List<AbstractType<?>> t2)
-
typeHashCode
public static int typeHashCode(AbstractType<?> t)
-
typeHashCode
public static int typeHashCode(java.util.List<AbstractType<?>> types)
-
with
public Functions with(Function fun)
Create a Functions instance with the provided function added
-
without
public Functions without(FunctionName name, java.util.List<AbstractType<?>> argTypes)
Creates a Functions instance with the function with the provided name and argument types removed
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-