public class IfFunction extends Object implements AnalyticsValueStream
Three arguments are required. The first, the conditional parameter, must be a BooleanValue
and
the later two, the if and else parameters, can be any type of AnalyticsValueStream
.
For each document, if the conditional value is true then the if-value is used otherwise the else-value is used.
The resulting Value or ValueStream will be typed with the closest super-type of the two non-conditional parameters.
(e.g. "if"(boolean,double,int) will return a double)
If two AnalyticsValue
s are passed as the if-else parameters, an AnalyticsValue
will be returned.
If either parameter isn't single-valued, a AnalyticsValueStream
will be returned.
AnalyticsValueStream.ExpressionType
Modifier and Type | Field and Description |
---|---|
static ExpressionFactory.CreatorFunction |
creatorFunction |
static String |
name |
Constructor and Description |
---|
IfFunction(BooleanValue ifExpr,
AnalyticsValueStream thenExpr,
AnalyticsValueStream elseExpr) |
Modifier and Type | Method and Description |
---|---|
String |
getExpressionStr()
Get the expression string of the analytics value stream.
|
AnalyticsValueStream.ExpressionType |
getExpressionType()
Get the type of the expression that this class represents.
|
String |
getName()
Get the name of function or value.
|
void |
streamObjects(Consumer<Object> cons)
Stream the object representations of all current values, if any exist.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createExpressionString, determineMappingPhase
public static final String name
public static final ExpressionFactory.CreatorFunction creatorFunction
public IfFunction(BooleanValue ifExpr, AnalyticsValueStream thenExpr, AnalyticsValueStream elseExpr) throws SolrException
SolrException
public void streamObjects(Consumer<Object> cons)
AnalyticsValueStream
streamObjects
in interface AnalyticsValueStream
cons
- The consumer to accept the valuespublic String getName()
AnalyticsValueStream
getName
in interface AnalyticsValueStream
public String getExpressionStr()
AnalyticsValueStream
ExpressionFactory.createExpression(String)
, the exact same expression should be created.getExpressionStr
in interface AnalyticsValueStream
public AnalyticsValueStream.ExpressionType getExpressionType()
AnalyticsValueStream
getExpressionType
in interface AnalyticsValueStream
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.