Class IntegerCastFunction
java.lang.Object
org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.CastFunction
org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.IntegerCastFunction
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
ByteCast,IntCast,IntegerCast,LongCast,NegativeIntegerCast,NonNegativeIntegerCast,NonPositiveIntegerCast,PositiveIntegerCast,ShortCast,UnsignedByteCast,UnsignedIntCast,UnsignedLongCast,UnsignedShortCast
Abstract superclass for
CastFunctions that cast their arguments to an xsd:integer or one of its derived
types.- Author:
- Jeen Broekstra
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Literalconvert(ValueFactory valueFactory, Value value) Convert the supplied value to a literal of the function output datatype.createTypedLiteral(ValueFactory vf, boolean booleanValue) create aLiteralwith the specific datatype for the supplied boolean value.createTypedLiteral(ValueFactory vf, BigInteger integerValue) create aLiteralwith the specific datatype for the suppliedBigIntegervalue.Methods inherited from class org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.CastFunction
evaluate, getURI, getXsdDatatype, getXsdName, isValidForDatatype, typeErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.function.Function
evaluate, mustReturnDifferentResult
-
Constructor Details
-
IntegerCastFunction
public IntegerCastFunction()
-
-
Method Details
-
convert
protected Literal convert(ValueFactory valueFactory, Value value) throws ValueExprEvaluationException Description copied from class:CastFunctionConvert the supplied value to a literal of the function output datatype.- Specified by:
convertin classCastFunction- Parameters:
valueFactory- the valueFactory to usevalue- a value that is not a string-typed literal, and not a literal of the same datatype as the function output datatype.- Returns:
- a literal value of the function output datatype
- Throws:
ValueExprEvaluationException- if an error occurs in conversion.
-
createTypedLiteral
protected abstract Optional<Literal> createTypedLiteral(ValueFactory vf, BigInteger integerValue) throws ArithmeticException create aLiteralwith the specific datatype for the suppliedBigIntegervalue.- Parameters:
vf- theValueFactoryto use for creating theLiteralintegerValue- the integer value to use for creating theLiteral- Returns:
- an
Optionalliteral value, which may be empty if the supplied integerValue can not be successfully converted to the specific datatype. - Throws:
ArithmeticException- if an error occurs when attempting to convert the supplied value to a value of the specific datatype.
-
createTypedLiteral
create aLiteralwith the specific datatype for the supplied boolean value.- Parameters:
vf- theValueFactoryto use for creating theLiteralbooleanValue- the boolean value to use for creating theLiteral- Returns:
- an
Optionalliteral value, which may be empty if the supplied boolean value can not be successfully converted to the specific datatype.
-