Class SerializationContext
- java.lang.Object
-
- com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext
-
- com.yahoo.searchlib.rankingexpression.rule.SerializationContext
-
public class SerializationContext extends FunctionReferenceContext
Context needed to serialize an expression to a string. This has the lifetime of a single serialization- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description SerializationContext()
Create a context for a single serialization taskSerializationContext(com.google.common.collect.ImmutableMap<String,ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Deprecated, for removal: This API element is subject to removal in a future version.Useinstead
SerializationContext(Collection<ExpressionFunction> functions)
Create a context for a single serialization taskSerializationContext(Collection<ExpressionFunction> functions, Map<String,String> bindings)
Create a context for a single serialization taskSerializationContext(Collection<ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Create a context for a single serialization taskSerializationContext(Map<String,ExpressionFunction> functions)
Create a context for a single serialization taskSerializationContext(Map<String,ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Create a context for a single serialization task
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArgumentTypeSerialization(String functionName, String argumentName, com.yahoo.tensor.TensorType type)
Adds the serialization of the an argument type to a functionvoid
addFunctionSerialization(String name, String expressionString)
Adds the serialization of a functionvoid
addFunctionTypeSerialization(String functionName, com.yahoo.tensor.TensorType type)
Adds the serialization of the return type of a functionboolean
needSerialization(String functionName)
Map<String,String>
serializedFunctions()
SerializationContext
withBindings(Map<String,String> bindings)
Returns a new context with the bindings replaced by the given bindingsSerializationContext
withoutBindings()
Returns a fresh context without bindings-
Methods inherited from class com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext
functions, getBinding, getFunction, getFunctions
-
-
-
-
Constructor Detail
-
SerializationContext
public SerializationContext()
Create a context for a single serialization task
-
SerializationContext
public SerializationContext(Collection<ExpressionFunction> functions)
Create a context for a single serialization task
-
SerializationContext
public SerializationContext(Map<String,ExpressionFunction> functions)
Create a context for a single serialization task
-
SerializationContext
public SerializationContext(Collection<ExpressionFunction> functions, Map<String,String> bindings)
Create a context for a single serialization task
-
SerializationContext
public SerializationContext(Collection<ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Create a context for a single serialization task- Parameters:
functions
- the functions of thisbindings
- the arguments of thisserializedFunctions
- a cache of serializedFunctions - the ownership of this map is transferred to this and will be modified in it
-
SerializationContext
public SerializationContext(Map<String,ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Create a context for a single serialization task- Parameters:
functions
- the functions of thisbindings
- the arguments of thisserializedFunctions
- a cache of serializedFunctions - the ownership of this map is transferred to this and will be modified in it
-
SerializationContext
@Deprecated(forRemoval=true, since="7") public SerializationContext(com.google.common.collect.ImmutableMap<String,ExpressionFunction> functions, Map<String,String> bindings, Map<String,String> serializedFunctions)
Deprecated, for removal: This API element is subject to removal in a future version.Useinstead
-
-
Method Detail
-
addFunctionSerialization
public void addFunctionSerialization(String name, String expressionString)
Adds the serialization of a function
-
addArgumentTypeSerialization
public void addArgumentTypeSerialization(String functionName, String argumentName, com.yahoo.tensor.TensorType type)
Adds the serialization of the an argument type to a function
-
addFunctionTypeSerialization
public void addFunctionTypeSerialization(String functionName, com.yahoo.tensor.TensorType type)
Adds the serialization of the return type of a function
-
withBindings
public SerializationContext withBindings(Map<String,String> bindings)
Description copied from class:FunctionReferenceContext
Returns a new context with the bindings replaced by the given bindings- Overrides:
withBindings
in classFunctionReferenceContext
-
withoutBindings
public SerializationContext withoutBindings()
Returns a fresh context without bindings- Overrides:
withoutBindings
in classFunctionReferenceContext
-
needSerialization
public boolean needSerialization(String functionName)
-
-