Package org.mozilla.zest.core.v1
Class ZestExpressionProtocol
- java.lang.Object
-
- org.mozilla.zest.core.v1.ZestElement
-
- org.mozilla.zest.core.v1.ZestExpression
-
- org.mozilla.zest.core.v1.ZestExpressionProtocol
-
- All Implemented Interfaces:
ZestExpressionElement
public class ZestExpressionProtocol extends ZestExpression
AZestExpressionthat checks if thelast requesthas a given protocol (for example, HTTPS).The check is done in a case-insensitive manner. The expression returns
falseif no protocol was set (that is,null).- Since:
- 0.14.0
-
-
Field Summary
-
Fields inherited from class org.mozilla.zest.core.v1.ZestElement
JSON_ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description ZestExpressionProtocol()Constructs aZestExpressionProtocolwith no protocol.ZestExpressionProtocol(String protocol)Constructs aZestExpressionProtocolwith the given protocol.ZestExpressionProtocol(String protocol, boolean inverse)Constructs aZestExpressionProtocolwith the given protocol and inverse state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ZestExpressionProtocoldeepCopy()Deep copy.StringgetProtocol()Gets the protocol that the request must have.booleanisTrue(ZestRuntime runtime)Tells whether or not thelast requestmatchesthe protocolset.voidsetProtocol(String protocol)Sets the protocol that the request must have.StringtoString()-
Methods inherited from class org.mozilla.zest.core.v1.ZestExpression
evaluate, isInverse, isLeaf, setInverse
-
Methods inherited from class org.mozilla.zest.core.v1.ZestElement
getElementType, isSameSubclass, setElementType
-
-
-
-
Constructor Detail
-
ZestExpressionProtocol
public ZestExpressionProtocol()
Constructs aZestExpressionProtocolwith no protocol.
-
ZestExpressionProtocol
public ZestExpressionProtocol(String protocol)
Constructs aZestExpressionProtocolwith the given protocol.- Parameters:
protocol- the protocol that the request must have for the expression to returntrue.
-
ZestExpressionProtocol
public ZestExpressionProtocol(String protocol, boolean inverse)
Constructs aZestExpressionProtocolwith the given protocol and inverse state.- Parameters:
protocol- the protocol that the request must have for the expression to returntrue.inverse- if the expression should be the inverse.
-
-
Method Detail
-
isTrue
public boolean isTrue(ZestRuntime runtime)
Tells whether or not thelast requestmatchesthe protocolset.- Parameters:
runtime- the runtime- Returns:
- the boolean value of the expression without inverse flag
-
getProtocol
public String getProtocol()
Gets the protocol that the request must have.- Returns:
- the protocol, might be
null.
-
setProtocol
public void setProtocol(String protocol)
Sets the protocol that the request must have.- Parameters:
protocol- the new protocol
-
deepCopy
public ZestExpressionProtocol deepCopy()
Description copied from class:ZestElementDeep copy.- Specified by:
deepCopyin interfaceZestExpressionElement- Specified by:
deepCopyin classZestExpression- Returns:
- the zest element
- See Also:
ZestElement
-
-